示例#1
0
        public void Test_Writing_An_Instance_Of_A_Tree_With_Height_3()
        {
            IDataNode rootNode = TreeWithHeight3.Build();

            TreeWithHeight3.Class value = new TreeWithHeight3.Class
            {
                Child1 = new TreeWithHeight2.Class
                {
                    Long  = 1,
                    Child = new TreeWithHeight1.Class
                    {
                        Int   = 2,
                        Float = 3.5f,
                        Byte  = 4
                    }
                },
                Child2 = new TreeWithHeight2.Class
                {
                    Long  = 5,
                    Child = new TreeWithHeight1.Class
                    {
                        Int   = 6,
                        Float = 7.5f,
                        Byte  = 8
                    }
                }
            };

            treeWriter.Write(binaryWriter, value, rootNode)
            .Should()
            .BeEmpty();

            Received.InOrder(() => VerifyWriteTreeWithHeight3(rootNode, value));
        }
示例#2
0
        public void Test_Reading_An_Instance_Of_A_Tree_With_Height_3()
        {
            IDataNode rootNode = TreeWithHeight3.Build();

            TreeWithHeight3.Class expected = new TreeWithHeight3.Class
            {
                Child1 = new TreeWithHeight2.Class
                {
                    Long  = 1,
                    Child = new TreeWithHeight1.Class
                    {
                        Int   = 2,
                        Float = 3.5f,
                        Byte  = 4
                    }
                },
                Child2 = new TreeWithHeight2.Class
                {
                    Long  = 5,
                    Child = new TreeWithHeight1.Class
                    {
                        Int   = 6,
                        Float = 7.5f,
                        Byte  = 8
                    }
                }
            };

            SetupTreeWithHeight3(rootNode, expected);

            object result = treeReader.Read(binaryReader, rootNode);

            Received.InOrder(() => VerifyReadTreeWithHeight3(rootNode));

            result.Should().BeEquivalentTo(expected);
        }
示例#3
0
 private void VerifyWriteTreeWithHeight3(IDataNode node, TreeWithHeight3.Class value)
 {
     node.Write(binaryWriter, value);
     VerifyWriteTreeWithHeight2(node.Edges[0].ChildNode as IDataNode, value.Child1);
     VerifyWriteTreeWithHeight2(node.Edges[1].ChildNode as IDataNode, value.Child2);
 }
示例#4
0
 private void SetupTreeWithHeight3(IDataNode node, TreeWithHeight3.Class expected)
 {
     node.Read(binaryReader).Returns(_ => new TreeWithHeight3.Class());
     SetupTreeWithHeight2(node.Edges[0].ChildNode as IDataNode, expected.Child1);
     SetupTreeWithHeight2(node.Edges[1].ChildNode as IDataNode, expected.Child2);
 }