-
Notifications
You must be signed in to change notification settings - Fork 4
Client Testing
patriciamazere edited this page Aug 14, 2019
·
1 revision
In order to mock the feature toggle values in your tests, Moggles.ConfigureForTestingMode()
will have to be called before each test and a key will need to be added in the tests configuration file (TestingMode) together with the feature toggle value.
-
NET. Framework
Moggles.ConfigureForTestingMode();
In configuration file:
web.config<add key="Moggles.TestingMode" value="true" /> <add key="Moggles.TestFeatureToggle" value="true" />
In this case
TestFeatureToggle
will have the same value in all tests.or
ConfigurationManager.AppSettings["Moggles.TestingMode"] = "true"; ConfigurationManager.AppSettings["Moggles.TestFeatureToggle"] = "true";
This option can be used to set
TestFeatureToggle
with different values in each test. -
NET. Core
var configuration = new ConfigurationBuilder() .AddJsonFile("testConfig.json") .Build(); Moggles.ConfigureForTestingMode(configuration);
In configuration file:
appsettings.json"Moggles": { "TestingMode": "true", "TestFeatureToggle": "true" }
In this case
TestFeatureToggle
will have the same value in all tests.or
configuration["Moggles:TestingMode"] = "true"; configuration["Moggles:TestFeatureToggle"] = "true";
This option can be used to set
TestFeatureToggle
with different values in each test.