Esempio n. 1
0
        public void Test1()
        {
            var node     = new Node("root", new Node("left", new Node("left.left")), new Node("right"));
            var expected = "left.left";

            var serialiedAndDeserializedNode = Node.Deserialize(Node.Serialize(node));
            var actual = serialiedAndDeserializedNode.Left.Left.Value;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void Deserialize_ShouldReturnANodeWithoutChildren_ForAStringWithValueAndEmptyNodes()
        {
            var serializedNode = "{\"Value\":\"root\",\"Left\":null,\"Right\":null}";
            var expected       = new Node("root");

            var actual = Node.Deserialize(serializedNode);

            Assert.AreEqual(expected.Value, actual.Value);
            Assert.AreEqual(expected.Left, actual.Left);
            Assert.AreEqual(expected.Right, actual.Right);
        }