Example #1
0
        public void TurnAttributesIntoChildren_FewAttributes_TurnsCorrectly()
        {
            Dictionary <string, string> attributes = new Dictionary <string, string>();

            attributes.Add("Att1", "Val1");
            attributes.Add("VIN", "1234");
            DeserializedElement testElement = new DeserializedElement(name: "Test element", attributes: attributes);

            testElement.TurnAttributesIntoChildren();

            Assert.AreEqual(2, testElement.Children.Count);
            Assert.AreEqual(0, testElement.Attributes.Count);
            Assert.AreEqual("Att1", testElement.Children.First().Name);
            Assert.AreEqual("Val1", testElement.Children.First().Value);
            Assert.AreEqual("VIN", testElement.Children.Last().Name);
            Assert.AreEqual("1234", testElement.Children.Last().Value);
        }
Example #2
0
        public static void equality()
        {
            DeserializedElement t1 = new DeserializedElementTest(
                id: 1,
                type: ElementType.AbstractImage
                );

            DeserializedElement t2 = new DeserializedElementTest(
                id: 1,
                type: ElementType.AbstractImage
                );

            DeserializedElement t3 = new DeserializedElementTest(
                id: 1,
                type: ElementType.ClusterType
                );

            DeserializedElement t4 = new DeserializedElementTest(
                id: 2,
                type: ElementType.AbstractImage
                );

            DeserializedElement tN = null;

            Assert.AreEqual(t1, t2);
            Assert.AreNotEqual(t1, t3);
            Assert.AreNotEqual(t1, t4);
            Assert.AreNotEqual(t1, tN);

            Assert.That(t1 == t2);
            Assert.That(t1 != t3);
            Assert.That(t1 != t4);
            Assert.That(t1 != tN);

            Assert.That(t2 == t1);
            Assert.That(t3 != t1);
            Assert.That(t4 != t1);
            Assert.That(tN != t1);
        }