コード例 #1
0
        public void IsEnabled_Feature2()
        {
            var target = new FeatureSwitch();
            target.ParseFeatureSwitches(collection);

            Assert.IsTrue((target as IFeatureSwitch)["Feature2"]);
        }
コード例 #2
0
        public void IsEnabled_SubFeature3()
        {
            var target = new FeatureSwitch();

            target.ParseFeatureSwitches(collection);

            Assert.IsFalse((target as IFeatureSwitch)["Feature2.SubFeature2.SubFeature3"]);
        }
コード例 #3
0
        public void IsEnabled_Feature2()
        {
            var target = new FeatureSwitch();

            target.ParseFeatureSwitches(collection);

            Assert.IsTrue((target as IFeatureSwitch)["Feature2"]);
        }
コード例 #4
0
        public void ParseFeatureSwitches_NumberOfItems()
        {
            var target = new FeatureSwitch();

            target.ParseFeatureSwitches(collection);

            Assert.AreEqual(5, target.Features.Count);
        }
コード例 #5
0
 public void Create_Null()
 {
     try
     {
         FeatureSwitch.Create(null);
         Assert.Fail("An ArgumentNullException was expected.");
     }
     catch (System.ArgumentNullException) { }
 }
コード例 #6
0
        /// <summary>
        ///     Creates an instance of <see href="IFeatureSwitch"/>.
        ///
        ///     The sole parameter is a stream that represents the 
        ///     feature configuration file.
        /// </summary>
        public static IFeatureSwitch Create(System.IO.Stream stream)
        {
            if(stream == null)
                throw new System.ArgumentNullException("stream");

            FeatureSwitch result = new FeatureSwitch();
            result.ParseFeatureSwitches(FeatureModelCollection.Deserialize(stream));
            return result;
        }
コード例 #7
0
        /// <summary>
        ///     Creates an instance of <see href="IFeatureSwitch"/>.
        ///
        ///     The sole parameter is a stream that represents the
        ///     feature configuration file.
        /// </summary>
        public static IFeatureSwitch Create(System.IO.Stream stream)
        {
            if (stream == null)
            {
                throw new System.ArgumentNullException("stream");
            }

            FeatureSwitch result = new FeatureSwitch();

            result.ParseFeatureSwitches(FeatureModelCollection.Deserialize(stream));
            return(result);
        }
コード例 #8
0
        public void EndToEnd_True()
        {
            string xml = @"<?xml version=""1.0"" encoding=""utf-8""?>

<Features xmlns=""https://www.kcl-data.com"">
    <Feature Key=""Login"" Enabled=""true""/>
</Features>";

            System.IO.MemoryStream stream = new System.IO.MemoryStream(System.Text.Encoding.Default.GetBytes(xml));

            IFeatureSwitch fs = FeatureSwitch.Create(stream);

            Assert.IsTrue(fs["Login"]);
        }
コード例 #9
0
        public void Constructor_FeaturesPopulated()
        {
            var target = new FeatureSwitch();

            Assert.IsNotNull(target.Features);
        }
コード例 #10
0
        public void IsEnabled_SubFeature3()
        {
            var target = new FeatureSwitch();
            target.ParseFeatureSwitches(collection);

            Assert.IsFalse((target as IFeatureSwitch)["Feature2.SubFeature2.SubFeature3"]);
        }
コード例 #11
0
 public void Constructor_FeaturesPopulated()
 {
     var target = new FeatureSwitch();
     Assert.IsNotNull(target.Features);
 }
コード例 #12
0
        public void ParseFeatureSwitches_NumberOfItems()
        {
            var target = new FeatureSwitch();
            target.ParseFeatureSwitches(collection);

            Assert.AreEqual(5, target.Features.Count);
        }