Skip to content

0.3.0

Choose a tag to compare

@seesharper seesharper released this 22 Apr 10:54
· 5 commits to master since this release
13a0958

Change Log

0.3.0 (04/22/2026)

Full Changelog

Merged Pull Requests

Reset mock when MockService is called again for the same type (04/22/2026) #10 (seesharper)

Summary

  • RegisterMockAsSingleton<T> now tracks registered mocks per TestApplication instance using a ConditionalWeakTable<IHostBuilderConfiguration, Dictionary<Type, object>>
  • A second call to MockService<T> (or any of its typed wrappers) for an already-registered type returns the same Mock<T> instance with Reset() called, rather than creating and registering a new one
  • This works after CreateClient() has been called since the mock object already registered as a singleton in DI is reset in place

Test plan

  • ShouldResetMockWhenCalledTwiceOnSameTestApplication verifies the returned mock is the same instance, invocations are cleared after reset, and only the new round's calls are recorded
  • All 18 existing tests continue to pass

🤖 Generated with Claude Code