コード例 #1
0
ファイル: EdgeTrackerTests.cs プロジェクト: Giorgi/fluentdot
        public void GetEdgeByTag_Should_Retrieve_Node_By_Tag() {
            var tracker = new EdgeTracker();

            var node1 = MockRepository.GenerateMock<IGraphNode>();
            var node2 = MockRepository.GenerateMock<IGraphNode>();
            var node3 = MockRepository.GenerateMock<IGraphNode>();
            var node4 = MockRepository.GenerateMock<IGraphNode>();

            var edge1 = new UndirectedEdge(new NodeTarget(node1), new NodeTarget(node2)) {Tag = 1};
            var edge2 = new UndirectedEdge(new NodeTarget(node3), new NodeTarget(node4)) { Tag = 2 };

            tracker.AddEdge(edge1);
            tracker.AddEdge(edge2);

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

            Assert.AreSame(tracker.GetEdgeByTag(1), edge1);
            Assert.AreSame(tracker.GetEdgeByTag(2), edge2);
        }
コード例 #2
0
ファイル: EdgeTrackerTests.cs プロジェクト: Giorgi/fluentdot
        public void GetEdgeByTag_With_Invalid_Tag_Should_Return_Null() {
            var tracker = new EdgeTracker();

            var node1 = MockRepository.GenerateMock<IGraphNode>();
            var node2 = MockRepository.GenerateMock<IGraphNode>();

            var edge = new UndirectedEdge(new NodeTarget(node1), new NodeTarget(node2));
            tracker.AddEdge(edge);

            Assert.AreEqual(tracker.Edges.Count(), 1);

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