Example #1
0
        public void CanStreamEnumerables()
        {
            string xml = Scenario1.Xml;

            Validate(action: () => XmlStreamer.StreamInstances <EnumerableSets>(xml));
            Debug.WriteLine(xml);
        }
Example #2
0
        public void CanStreamOutIEnumerablesUsingStandardDeserialization()
        {
            var file     = new FileInfo(testFiles.First(fileName => fileName.Contains("Town.xml")));
            var streamer = new XmlStreamer(file);
            var result   = streamer.StreamInstances <Town>();

            Assert.NotNull(result);
            //result.Dump();
        }
Example #3
0
        public void CanStreamOutArrayOfStrings()
        {
            var file     = new FileInfo(testFiles.First(fileName => fileName.Contains("Details.xml")));
            var streamer = new XmlStreamer(file);
            var details  = streamer.StreamInstances <ScenarioDetails>();

            Assert.NotNull(details);
            //details.Dump("scenario details");
        }
Example #4
0
        public void HappyPathTest()
        {
            string fileName = "Keyboards.xml";
            string xml      = "";

            var keyboard = XmlStreamer.StreamInstances <Keyboard>(xml).First();

            Debug.WriteLine(keyboard.Name);
            Debug.WriteLine(keyboard.Price);
            Assert.NotNull(keyboard);
        }
Example #5
0
        static IEnumerable <Store> StreamFromString()
        {
            string filePath = "Stores.xml";
            string xml      = "";
            var    stores   = XmlStreamer.StreamInstances <Store>(xml);

            foreach (var store in stores)
            {
                Debug.WriteLine(store?.ToString());
            }

            Debug.WriteLine(stores.Count());
            return(stores);
        }
Example #6
0
        IEnumerable <Store> StreamFromFile()
        {
            //Assemble
            string xmlFilePath = testFiles.First(fileName => fileName.Contains("Store.xml"));
            var    xmlStreamer = new XmlStreamer(xmlFilePath);

            //Act
            IEnumerable <Store> stores = xmlStreamer.StreamInstances <Store>();

            //Assert:
            Assert.NotNull(stores);
            Assert.True(stores.Any());
            Debug.WriteLine(stores.Count());
            return(stores);
        }