• Unit testing with Polly - with examples
  • [1] I want to unit-test what my code does, independent of Polly policies I apply
  • Use DI to separate policy creation from policy usage
  • Using a mock to verify that the system-under-test uses the policy
  • Use PolicyRegistry with DI, to work with policy collections
  • Stubbing Polly out of tests with PolicyRegistry
  • Using mock policies in tests, with PolicyRegistry
  • Use a policy factory, if you generate policies dynamically
  • [2] I want to test that I've configured Polly policies to achieve my desired resilience strategy
  • [2a] Test policies with integration tests through the consuming code
  • [2b] Test policies with unit-tests, independent of consuming code
  • Recommendation: Focus on testing your own logic rather than Polly
  • [3] I want to unit-test how my code reacts to results or faults returned by the execution through Polly
  • [4] I want to unit-test that the Polly policies I apply actually do what they say on the tin
  • Questions?