Esempio n. 1
0
        public void GetNodeByTag_Should_Retrieve_Node_By_Tag() {
            var tracker = new NodeTracker();
            
            var node1 = new GraphNode("name1") {Tag = 1};
            var node2 = new GraphNode("name2") {Tag = 2};

            tracker.AddNode(node1);
            tracker.AddNode(node2);

            Assert.AreEqual(tracker.Nodes.Count(), 2);

            Assert.AreSame(tracker.GetNodeByTag(1), node1);
            Assert.AreSame(tracker.GetNodeByTag(2), node2);
        }
Esempio n. 2
0
        public void GetNodeByTag_With_Invalid_Tag_Should_Return_Null() {
            var tracker = new NodeTracker();

            var node1 = new GraphNode("name1") { Tag = 1 };
            tracker.AddNode(node1);
            
            Assert.AreEqual(tracker.Nodes.Count(), 1);

            Assert.IsNull(tracker.GetNodeByTag(2));
        }