Skip to content

Add unit/integration test project — no tests currently exist #10

Description

@dobby-coder

Problem

The repo has no test project. CI runs dotnet build and dotnet pack but never executes tests. Critical paths are completely unverified:

  • src/Crypto/SealPipeline.cs — policy JSON construction (BuildPolicyJson), parallel key fetching, native FFI invocation
  • src/Api/CryptifyClient.cs — chunked upload (Content-Range formatting, token rotation across chunks, init/finalize wiring)
  • src/Api/PkgClient.cs — JSON parsing of MPK and signing key responses
  • src/Zip/ZipHelper.cs — file packing
  • Recipient/policy edge cases (e.g. EmailDomain with no @, multiple extras)

Suggested approach

  • Add tests/E4A.PostGuard.Tests/ xUnit project, register in E4A.PostGuard.slnx
  • Pure unit tests for BuildPolicyJson, ZipHelper, recipient builders, exception types
  • Integration tests for the API clients using a mock HttpMessageHandler so the full chunked-upload flow is exercised without a live Cryptify
  • Add a dotnet test --configuration Release step to .github/workflows/build.yml between Build and Pack

Why now

Without any tests, refactors (e.g. swapping byte[]Stream) and dependency bumps land blind. A baseline unit suite makes future work safer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions