public void CollectionNamespaceForAllItemsDeserializationTest() { var serializer = new YAXSerializer(typeof(CellPhone_CollectionNamespaceForAllItems), YAXExceptionHandlingPolicies.DoNotThrow, YAXExceptionTypes.Warning, YAXSerializationOptions.SerializeNullObjects); string got = serializer.Serialize(CellPhone_CollectionNamespaceForAllItems.GetSampleInstance()); var deserialized = serializer.Deserialize(got) as CellPhone_CollectionNamespaceForAllItems; Assert.That(deserialized, Is.Not.Null); Assert.That(serializer.ParsingErrors, Has.Count.EqualTo(0)); }
public void CollectionNamespaceForAllItemsSerializationTest() { const string result = @"<MobilePhone xmlns:app=""http://namespace.org/apps"" xmlns:cls=""http://namespace.org/colorCol"" xmlns:mdls=""http://namespace.org/modelCol"" xmlns:p1=""http://namespace.org/appName"" xmlns:p2=""http://namespace.org/color""> <DeviceBrand>Samsung Galaxy Nexus</DeviceBrand> <OS>Android</OS> <p1:AppName>Google Map</p1:AppName> <p1:AppName>Google+</p1:AppName> <p1:AppName>Google Play</p1:AppName> <cls:AvailableColors> <p2:TheColor>red</p2:TheColor> <p2:TheColor>black</p2:TheColor> <p2:TheColor>white</p2:TheColor> </cls:AvailableColors> <mdls:AvailableModels>S1,MII,SXi,NoneSense</mdls:AvailableModels> </MobilePhone>"; var serializer = new YAXSerializer(typeof(CellPhone_CollectionNamespaceForAllItems), YAXExceptionHandlingPolicies.DoNotThrow, YAXExceptionTypes.Warning, YAXSerializationOptions.SerializeNullObjects); string got = serializer.Serialize(CellPhone_CollectionNamespaceForAllItems.GetSampleInstance()); Assert.That(got, Is.EqualTo(result)); }