Example #1
0
        public void TestDDNodeXmlSerializationWithoutAttributeCollection()
        {
            var stream = UTestDrDataCommon.GetMemoryStreamFromFile();

            stream.Position = 0;
            var deserialized = XMLDeserialize(stream); // check looping
        }
Example #2
0
        public void TestDDNodeXmlDeserializationFromFileLegacyAttributeCollection()
        {
            var n = new DDNode("name", "type");

            n.Attributes.Add("bool", true);
            n.Attributes.Add("int", 1);
            ValidateXMLDeserialization(n, UTestDrDataCommon.GetMemoryStreamFromFile());
        }
Example #3
0
        public void TestDDNodeXmlDeserializationFromFileLegacyAttributeCollectionWithHierarchy()
        {
            var n = new DDNode("name", "type");

            n.Attributes.Add("bool", false);
            n.Attributes.Add("int", -1);
            n.Add("ChildNode").Add("SubChildNode").Attributes.Add("string", "string");
            ValidateXMLDeserialization(n, UTestDrDataCommon.GetMemoryStreamFromFile());
        }
        public void TestDDAttributesCollectionXmlSerializationFromFileSkipIncorrectValue()
        {
            var a = new DDAttributesCollection();

            a.Add(string.Empty, null);
            a.Add("A", null);
            a.Add("B", new DDValue(new string[] { "", "Value_A", "Value_B" }));
            ValidateXMLDeserialization(a, UTestDrDataCommon.GetMemoryStreamFromFile());
        }
Example #5
0
        public void TestDeserializationFromXMLAndAutoNameGeneration()
        {
            var n = DDNodeSxe.Deserialize(UTestDrDataCommon.GetMemoryStreamFromFile());

            Assert.IsTrue(n.Type == String.Empty, "Type of nodes are not equals after deserialization with auto node name generation.");
            foreach (var c in n)
            {
                Assert.IsTrue(c.Value.Type == "Type", "Type of nodes are not equals after deserialization with auto node name generation.");
                var en = c.Value.Attributes.GetEnumerator();

                en.MoveNext();
            }
        }
Example #6
0
        private void TestMergeNodeWithAnotherNode(DDNode nDestination, DDNode.DDNODE_MERGE_OPTION option, ResolveConflict res)
        {
            var nSource = XMLDeserialize(UTestDrDataCommon.GetMemoryStreamFromFile(".\\XML\\" + UTestDrDataCommon.GetTestMethodName() + ".Source.xml"));

            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nDestination), UTestDrDataCommon.GetTestMethodName() + ".Destination.xml");
            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nSource), UTestDrDataCommon.GetTestMethodName() + ".Source.xml");

            nDestination.Merge(nSource, option, res);

            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nDestination), UTestDrDataCommon.GetTestMethodName() + ".Actual.xml");
            var nExpected = XMLDeserialize(UTestDrDataCommon.GetMemoryStreamFromFile(".\\XML\\" + UTestDrDataCommon.GetTestMethodName() + ".Expected.xml"));

            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nExpected), UTestDrDataCommon.GetTestMethodName() + ".Expected.xml");

            Assert.IsTrue(nDestination == nExpected, "The actual node is not equal expected node. See xml files in the bin folder.");
        }
Example #7
0
        public void TestMergeStockCollectionWithEmptyCollection()
        {
            var nDestination = GetStockHierarhy();
            var nSource      = new DDNode("Test");

            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nDestination), UTestDrDataCommon.GetTestMethodName() + ".Destination.xml");
            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nSource), UTestDrDataCommon.GetTestMethodName() + ".Source.xml");

            nDestination.Merge(nSource);

            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nDestination), UTestDrDataCommon.GetTestMethodName() + ".Actual.xml");
            var nExpected = XMLDeserialize(UTestDrDataCommon.GetMemoryStreamFromFile(".\\XML\\" + UTestDrDataCommon.GetTestMethodName() + ".Expected.xml"));

            UTestDrDataCommon.WriteMemmoryStreamToFile(XMLSerialize(nExpected), UTestDrDataCommon.GetTestMethodName() + ".Expected.xml");

            Assert.IsTrue(nDestination == nExpected, "The actual node is not equal expected node. See xml files in the bin folder.");
        }
Example #8
0
 public void TestDDNodeXmlSerializationFromFileSkipIncorrectedData()
 {
     ValidateXMLDeserialization(GetStockHierarhy(), UTestDrDataCommon.GetMemoryStreamFromFile());
 }
Example #9
0
 public void TestDDValueXmlSerializationFromFileSkippIncorrectedNodeTypeStringArrayDeepWithValue()
 {
     ValidateXMLDeserialization(new DDValue(new string[] { "TestValue", "TheLastValue" }), UTestDrDataCommon.GetMemoryStreamFromFile());
 }
Example #10
0
 public void TestDDValueXmlSerializationFromFileSkippIncorrectedNodeTypeStringEmpty()
 {
     ValidateXMLDeserialization(new DDValue(string.Empty), UTestDrDataCommon.GetMemoryStreamFromFile());
 }
Example #11
0
 public void TestDDValueXmlSerializationFromFileEmptyString()
 {
     ValidateXMLDeserialization(new DDValue(string.Empty), UTestDrDataCommon.GetMemoryStreamFromFile());
 }
 public void TestDDAttributesCollectionXmlSerializationFromFileEmpty()
 {
     ValidateXMLDeserialization(new DDAttributesCollection(), UTestDrDataCommon.GetMemoryStreamFromFile());
 }