Skip to content

[Testing] Improve SettingsManager tests — round-trip, encryption assertion, error handling #13

@jackby03

Description

@jackby03

Summary

The SettingsManager tests exist but are incomplete — they test serialization in isolation and bypass the file system. There is no test covering the full save → load round-trip, and the ICryptographyService mock does not assert that keys are actually encrypted before being written to disk.

What needs to be done

  • Full round-trip test: Save(settings) → read file → Load() → assert values match
  • Verify encrypted file: file on disk must not contain plain-text API key string
  • Verify that Load() on a missing file returns default settings (no exception)
  • Verify that Load() on a corrupted file returns default settings and logs an error
  • Verify that Save() uses ICryptographyService.Encrypt for credential fields
  • Test ExchangeCredential add/remove/set-active flows

Acceptance criteria

  • Round-trip test passes with temp directory
  • Corrupted file test passes (no crash)
  • Raw key is never written in plain text
  • All credential CRUD operations are covered
  • Tests clean up temp files in Dispose

References

  • src/Omnijure.Core/Features/Settings/
  • tests/Omnijure.Core.Tests/SettingsManagerTests.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions