mirror of
https://github.com/azaion/admin.git
synced 2026-04-23 02:56:34 +00:00
d320d6dd59
Made-with: Cursor
1.4 KiB
1.4 KiB
Module: Azaion.Test.SecurityTest
Purpose
xUnit tests for the Security encryption/decryption functionality.
Public Interface
| Test | Description |
|---|---|
EncryptDecryptTest |
Round-trip encrypt/decrypt of a ~1 KB string; asserts decrypted output matches original |
EncryptDecryptLargeFileTest |
Round-trip encrypt/decrypt of a ~400 MB generated file; compares SHA-256 hashes of original and decrypted files |
Internal Logic
- EncryptDecryptTest: creates a key via
Security.GetApiEncryptionKey, encrypts a test string to aMemoryStream, decrypts back, compares withFluentAssertions. - EncryptDecryptLargeFileTest: generates a large JSON file (4M numbers chunked), encrypts, decrypts to a new file, compares file hashes via
SHA256.HashDataAsync.
Private helpers:
CompareFiles— SHA-256 hash comparison of two filesCreateLargeFile— generates a large file by serializing number dictionaries in 100K chunksStringToStream— converts a UTF-8 string to aMemoryStream
Dependencies
Security(encrypt/decrypt)StreamExtensions.ConvertToStringFluentAssertionsNewtonsoft.Json- xUnit
Consumers
None — test module.
Data Models
None.
Configuration
None.
External Integrations
Local filesystem (creates/deletes large.txt and large_decrypted.txt during large file test).
Security
None.
Tests
This IS the test module.