public void IsEnabled_Feature2()
        {
            var target = new FeatureSwitch();
            target.ParseFeatureSwitches(collection);

            Assert.IsTrue((target as IFeatureSwitch)["Feature2"]);
        }
        public void IsEnabled_SubFeature3()
        {
            var target = new FeatureSwitch();

            target.ParseFeatureSwitches(collection);

            Assert.IsFalse((target as IFeatureSwitch)["Feature2.SubFeature2.SubFeature3"]);
        }
        public void IsEnabled_Feature2()
        {
            var target = new FeatureSwitch();

            target.ParseFeatureSwitches(collection);

            Assert.IsTrue((target as IFeatureSwitch)["Feature2"]);
        }
        public void ParseFeatureSwitches_NumberOfItems()
        {
            var target = new FeatureSwitch();

            target.ParseFeatureSwitches(collection);

            Assert.AreEqual(5, target.Features.Count);
        }
 public void Create_Null()
 {
     try
     {
         FeatureSwitch.Create(null);
         Assert.Fail("An ArgumentNullException was expected.");
     }
     catch (System.ArgumentNullException) { }
 }
        /// <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;
        }
Exemple #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);
        }
        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"]);
        }
        public void Constructor_FeaturesPopulated()
        {
            var target = new FeatureSwitch();

            Assert.IsNotNull(target.Features);
        }
        public void IsEnabled_SubFeature3()
        {
            var target = new FeatureSwitch();
            target.ParseFeatureSwitches(collection);

            Assert.IsFalse((target as IFeatureSwitch)["Feature2.SubFeature2.SubFeature3"]);
        }
 public void Constructor_FeaturesPopulated()
 {
     var target = new FeatureSwitch();
     Assert.IsNotNull(target.Features);
 }
        public void ParseFeatureSwitches_NumberOfItems()
        {
            var target = new FeatureSwitch();
            target.ParseFeatureSwitches(collection);

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