Esempio n. 1
0
        public void SimpleTest()
        {
            string      xaml       = @"<VSContainer xmlns=""clr-namespace:Test.Elements;assembly=XamlTestClasses""><VSContainer.Vehicle><Motorcycle>a motorcycle with great fuel economy at 70MPG</Motorcycle></VSContainer.Vehicle></VSContainer>";
            VSContainer c          = (VSContainer)XamlServices.Parse(xaml);
            Motorcycle  motorcycle = c.Vehicle as Motorcycle;

            Assert.IsNotNull(motorcycle);
            Assert.AreEqual(motorcycle.MPG, 70.0);
        }
Esempio n. 2
0
        public void RoundtripTest2()
        {
            StringBuilder sb   = new StringBuilder();
            Motorboat     boat = new Cruiser {
                Description = "Sleek look"
            };

            XamlServices.Save(XmlWriter.Create(sb), new VSContainer {
                Vehicle = boat
            });
            VSContainer c = (VSContainer)XamlServices.Parse(sb.ToString());
        }
Esempio n. 3
0
        public void RoundtripTest1()
        {
            StringBuilder sb   = new StringBuilder();
            Motorboat     boat = new SpeedBoat {
                MaxSpeed = 100
            };

            XamlServices.Save(XmlWriter.Create(sb), new VSContainer {
                Vehicle = boat
            });
            VSContainer c         = (VSContainer)XamlServices.Parse(sb.ToString());
            SpeedBoat   speedBoat = c.Vehicle as SpeedBoat;

            Assert.IsNotNull(speedBoat);
            Assert.AreEqual(speedBoat.MaxSpeed, 100);
        }
Esempio n. 4
0
 public void NoTCTest()
 {
     string      xaml = @"<VSContainer xmlns=""clr-namespace:MyNamespace;assembly=ValueSerializerTest""><VSContainer.Vehicle><Motorcycle2>a motorcycle with great fuel economy at 70MPG</Motorcycle2></VSContainer.Vehicle></VSContainer>";
     VSContainer c    = (VSContainer)XamlServices.Parse(xaml);
 }