public void TestAddingMultipleNodesRaisesCollectionChangedEvent() { bool eventFired = false; NotifyCollectionChangedAction action = NotifyCollectionChangedAction.Reset; GraphData g = new GraphData("scope"); Node node1 = new Node("Node1"); Node node2 = new Node("Node2"); Node node3 = new Node("Node3"); List <Node> nodes = new List <Node> { node1, node2, node3 }; g.CollectionChanged += (sender, e) => { action = e.Action; eventFired = true; }; EnqueueCallback(() => g.AddNodes(nodes)); EnqueueConditional(() => eventFired); EnqueueCallback(() => Assert.AreEqual(nodes.Count, g.Count)); EnqueueCallback(() => Assert.IsTrue(g.ContainsNode(node1))); EnqueueCallback(() => Assert.IsTrue(g.ContainsNode(node2))); EnqueueCallback(() => Assert.IsTrue(g.ContainsNode(node3))); EnqueueCallback(() => Assert.AreEqual <NotifyCollectionChangedAction>(NotifyCollectionChangedAction.Add, action)); EnqueueTestComplete(); }
/// <summary> /// /// </summary> /// <param name="numberOfNodes"></param> /// <param name="numberOfEdges"></param> /// <returns></returns> public GraphData GenerateGraph(string scope, int numberOfNodes, int numberOfEdges) { generatedGraph = new GraphData(scope); List<Node> nodes = GenerateNodes(numberOfNodes); List<IEdge> edges = GenerateEdges(numberOfEdges, nodes); generatedGraph.AddNodes(nodes); generatedGraph.AddEdges(edges); return generatedGraph; }
/// <summary> /// /// </summary> /// <param name="numberOfNodes"></param> /// <param name="numberOfEdges"></param> /// <returns></returns> public GraphData GenerateGraph(string scope, int numberOfNodes, int numberOfEdges) { generatedGraph = new GraphData(scope); List <Node> nodes = GenerateNodes(numberOfNodes); List <IEdge> edges = GenerateEdges(numberOfEdges, nodes); generatedGraph.AddNodes(nodes); generatedGraph.AddEdges(edges); return(generatedGraph); }
public void TestAddingMultipleNodes() { GraphData g = new GraphData("scope"); Node node1 = new Node("Node1"); Node node2 = new Node("Node2"); Node node3 = new Node("Node3"); List <Node> nodes = new List <Node> { node1, node2, node3 }; g.AddNodes(nodes); Assert.AreEqual(nodes.Count, g.Count); Assert.IsTrue(g.ContainsNode(node1)); Assert.IsTrue(g.ContainsNode(node2)); Assert.IsTrue(g.ContainsNode(node3)); }
public void TestRemoveMultipleNodes() { GraphData g = new GraphData("scope"); Node node1 = new Node("Node1"); Node node2 = new Node("Node2"); Node node3 = new Node("Node3"); Node node4 = new Node("Node4"); List <Node> nodes = new List <Node> { node1, node2, node3 }; g.AddNodes(nodes); g.AddNode(node4); g.RemoveNodes(nodes); Assert.AreEqual(1, g.Count); Assert.IsTrue(g.ContainsNode(node4)); }
public void TestRemoveMultipleNodes() { GraphData g = new GraphData("scope"); Node node1 = new Node("Node1"); Node node2 = new Node("Node2"); Node node3 = new Node("Node3"); Node node4 = new Node("Node4"); List<Node> nodes = new List<Node> { node1, node2, node3 }; g.AddNodes(nodes); g.AddNode(node4); g.RemoveNodes(nodes); Assert.AreEqual(1, g.Count); Assert.IsTrue(g.ContainsNode(node4)); }
public void TestAddingMultipleNodesRaisesCollectionChangedEvent() { bool eventFired = false; NotifyCollectionChangedAction action = NotifyCollectionChangedAction.Reset; GraphData g = new GraphData("scope"); Node node1 = new Node("Node1"); Node node2 = new Node("Node2"); Node node3 = new Node("Node3"); List<Node> nodes = new List<Node> { node1, node2, node3 }; g.CollectionChanged += (sender, e) => { action = e.Action; eventFired = true; }; EnqueueCallback(() => g.AddNodes(nodes)); EnqueueConditional(() => eventFired); EnqueueCallback(() => Assert.AreEqual(nodes.Count, g.Count)); EnqueueCallback(() => Assert.IsTrue(g.ContainsNode(node1))); EnqueueCallback(() => Assert.IsTrue(g.ContainsNode(node2))); EnqueueCallback(() => Assert.IsTrue(g.ContainsNode(node3))); EnqueueCallback(() => Assert.AreEqual<NotifyCollectionChangedAction>(NotifyCollectionChangedAction.Add, action)); EnqueueTestComplete(); }
public void TestAddingMultipleNodes() { GraphData g = new GraphData("scope"); Node node1 = new Node("Node1"); Node node2 = new Node("Node2"); Node node3 = new Node("Node3"); List<Node> nodes = new List<Node> { node1, node2, node3 }; g.AddNodes(nodes); Assert.AreEqual(nodes.Count, g.Count); Assert.IsTrue(g.ContainsNode(node1)); Assert.IsTrue(g.ContainsNode(node2)); Assert.IsTrue(g.ContainsNode(node3)); }