コード例 #1
0
            public void Exists()
            {
                DiSetup.Tests();

                IFeatureToggleManager featureToggleManager = DiHelper.GetService <IFeatureToggleManager>();

                featureToggleManager.Clear();
                featureToggleManager.Add(new StaticFeatureToggle("TestFeature", true));

                Assert.AreEqual(true, featureToggleManager.Exists("TestFeature"));
                Assert.AreEqual(false, featureToggleManager.Exists("TestFeature2"));
            }
コード例 #2
0
            public void AddVersionbasedFeatureToggle()
            {
                DiSetup.Tests();

                IFeatureToggleManager featureToggleManager = DiHelper.GetService <IFeatureToggleManager>();

                featureToggleManager.Clear();
                featureToggleManager.Add(new VersionbasedFeatureToggle("TestFeature", new Version(0, 8), this.GetType()));
                featureToggleManager.Add(new VersionbasedFeatureToggle("TestFeature2", new Version(1, 0), this.GetType()));

                //Assert.AreEqual(true, featureToggleManager.GetValue("TestFeature"));
                //Assert.AreEqual(false, featureToggleManager.GetValue("TestFeature2"));
            }
コード例 #3
0
            public void AddTimebasedFeatureToggle()
            {
                DiSetup.Tests();

                IFeatureToggleManager featureToggleManager = DiHelper.GetService <IFeatureToggleManager>();

                featureToggleManager.Clear();
                featureToggleManager.Add(new TimebasedFeatureToggle("TestFeature", DateTimeOffset.Now + TimeSpan.FromMilliseconds(10)));
                featureToggleManager.Add(new TimebasedFeatureToggle("TestFeature2", DateTimeOffset.Now + TimeSpan.FromDays(1)));

                Thread.Sleep(20);

                Assert.AreEqual(true, featureToggleManager.GetValue("TestFeature"));
                Assert.AreEqual(false, featureToggleManager.GetValue("TestFeature2"));
            }