jason-roberts / FeatureToggle

Simple, reliable feature toggles in .NET
http://dontcodetired.com/blog/?tag=/featuretoggle
Apache License 2.0
689 stars 111 forks source link

How to mock/test featuretoggles? #99

Closed geirsagberg closed 9 years ago

geirsagberg commented 9 years ago

Given a piece of code that uses e.g. SimpleFeatureToggle, I see no way to mock the AppSettingsProvider for unit tests etc.

Any ideas how to solve this?

jason-roberts commented 9 years ago

Hi @geirsagberg , all toggles implement the interface IFeatureToggle, so using your mocking framework of choice just create a mock IFeatureToggle and set the mocks return value for the property "bool FeatureEnabled {get;}"