Exemple #1
0
 public void Deserialize_NullStream()
 {
     try
     {
         FeatureModelCollection.Deserialize(null);
         Assert.Fail("An ArgumentNullException was expected.");
     }
     catch (System.ArgumentNullException) { }
 }
Exemple #2
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);
        }
Exemple #3
0
        public void Deserialize()
        {
            string xml = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Features xmlns=""https://www.kcl-data.com"">
    <Feature Key=""TestKey"" Enabled=""false""/>
</Features>";

            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            StreamWriter           writer = new StreamWriter(stream);

            writer.Write(xml);
            writer.Flush();

            stream.Position = 0;

            FeatureModelCollection collection = FeatureModelCollection.Deserialize(stream);

            Assert.IsNotNull(collection);
            Assert.AreEqual(1, collection.Items.Count);
            Assert.AreEqual("TestKey", collection.Items[0].Key);
            Assert.IsFalse(collection.Items[0].Enabled);
        }