ToString() public method

Returns a System.String that represents this instance.
public ToString ( ) : string
return string
Beispiel #1
0
        public void Node_ToString_WhenNotBroken_ExpectStringNode()
        {
            //------------Setup for test--------------------------
            var node = new Node("Node 1", 100, 100, false, false);
            const string expected = @"<node id=""Node 1"" x=""100"" y=""100"" broken=""False""></node>";

            //------------Execute Test---------------------------
            var result = node.ToString();

            //------------Assert Results-------------------------
            StringAssert.Contains(result, expected);
        }
Beispiel #2
0
        public void Node_ToString_WhenNodeContainsDependencies_ExpectStringNodeWithDependenices()
        {
            //------------Setup for test--------------------------
            var node = new Node("Node 1", 100, 100, true, true);
            node.NodeDependencies.Add(new Node("Dependant Node",200,100,false,false));
            const string expected = @"<node id=""Node 1"" x=""100"" y=""100"" broken=""True""><dependency id=""Dependant Node"" /></node>";

            //------------Execute Test---------------------------
            var result = node.ToString();

            //------------Assert Results-------------------------
            StringAssert.Contains(result, expected);
        }