# 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 a `MemoryStream`, decrypts back, compares with `FluentAssertions`. - **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 files - `CreateLargeFile` — generates a large file by serializing number dictionaries in 100K chunks - `StringToStream` — converts a UTF-8 string to a `MemoryStream` ## Dependencies - `Security` (encrypt/decrypt) - `StreamExtensions.ConvertToString` - `FluentAssertions` - `Newtonsoft.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.