public void TestRemoveNodeFromBaseMaterialGraphCleansEdges() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); var createdEdge = graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); var edge = graph.edges.FirstOrDefault(); Assert.AreEqual(createdEdge, edge); graph.RemoveNode(outputNode); Assert.AreEqual(1, graph.GetNodes <AbstractMaterialNode>().Count()); Assert.AreEqual(0, graph.edges.Count()); Assert.AreEqual(inputNode, graph.GetNodes <AbstractMaterialNode>().FirstOrDefault()); }
public void TestRemoveEdgeDoesntRemoveNodes() { GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Edge edge = new Edge(source, target); g.AddNode(source); g.AddNode(target); g.AddEdge(edge); if (!g.ContainsEdge(edge)) { Assert.Inconclusive("Edge not found in the collection after adding it."); } g.RemoveEdge(edge); if (g.ContainsEdge(edge)) { Assert.Inconclusive("Edge still found in the collection after removing it."); } Assert.IsTrue(g.ContainsNode(source)); Assert.IsTrue(g.ContainsNode(target)); }
public void TestCanConnectAndTraverseTwoNodesOnBaseMaterialGraph() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); var createdEdge = graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); var edge = graph.edges.FirstOrDefault(); Assert.AreEqual(createdEdge, edge); var foundOutputNode = graph.GetNodeFromGuid(edge.outputSlot.nodeGuid); var foundOutputSlot = foundOutputNode.FindOutputSlot <ISlot>(edge.outputSlot.slotId); Assert.AreEqual(outputNode, foundOutputNode); Assert.IsNotNull(foundOutputSlot); var foundInputNode = graph.GetNodeFromGuid(edge.inputSlot.nodeGuid); var foundInputSlot = foundInputNode.FindInputSlot <ISlot>(edge.inputSlot.slotId); Assert.AreEqual(inputNode, foundInputNode); Assert.IsNotNull(foundInputSlot); }
public void TestConectionToSameInputReplacesOldInput() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); var createdEdge = graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); var edge = graph.edges.FirstOrDefault(); Assert.AreEqual(createdEdge, edge); var createdEdge2 = graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); var edge2 = graph.edges.FirstOrDefault(); Assert.AreEqual(createdEdge2, edge2); }
public void TestAddingEdgeFiresCollectionChangedEvent() { bool eventFired = false; NotifyCollectionChangedAction action = NotifyCollectionChangedAction.Reset; GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Edge edge = new Edge(source, target); // TODO: This test is invalid because added Node objects to the collection will fire the same event g.CollectionChanged += (sender, e) => { action = e.Action; eventFired = true; }; EnqueueCallback(() => g.AddNode(source)); EnqueueCallback(() => g.AddNode(target)); EnqueueCallback(() => g.AddEdge(edge)); EnqueueConditional(() => eventFired); EnqueueCallback(() => Assert.IsTrue(eventFired)); EnqueueCallback(() => Assert.AreEqual <NotifyCollectionChangedAction>(NotifyCollectionChangedAction.Add, action)); EnqueueTestComplete(); }
public void Verify_Edge_Added_To_Physical_Graph_Once_Corresponding_Target_Node_Added() { int actualSourceEdges; int actualTargetEdges; int expectedSourceEdges = 1; int expectedTargetEdges = 1; INode source = PrepareNode("Node1", ghostNode: false); INode target = PrepareNode("Node2", ghostNode: true); IEdge orphan = new Edge(source, target); GraphData graphData = new GraphData("scope"); // Add an edge with ghost nodes to the graph graphData.AddNode(source); graphData.AddEdge(orphan); // Add the missing node target = PrepareNode("Node2", ghostNode: false); graphData.AddNode(target); // Get the actual count for nodes actualSourceEdges = graphData.Edges(source).Count(); actualTargetEdges = graphData.Edges(target).Count(); Assert.AreEqual(expectedSourceEdges, actualSourceEdges); Assert.AreEqual(expectedTargetEdges, actualTargetEdges); }
public void TestSetUp() { m_Graph = new GraphData(); m_DynamicNode = new DynamicNode(); m_Graph.AddNode(m_DynamicNode); m_StaticNode = new TestNode(); m_Graph.AddNode(m_StaticNode); }
public void TestSetUp() { m_Graph = new GraphData(); m_NodeA = new TestNode(); m_NodeB = new TestNode(); m_Graph.AddNode(m_NodeA); m_Graph.AddNode(m_NodeB); }
public void CreateAllNodes() { foreach (var materialNode in GetAllNodes()) { string nType = materialNode.GetType().ToString().Split('.').Last(); if (!m_NotAllowedNodes.Contains(nType)) { m_Graph.AddNode(materialNode); } } }
public void TestAddEdge() { GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Edge edge = new Edge(source, target); g.AddNode(source); g.AddNode(target); g.AddEdge(edge); Assert.IsTrue(g.ContainsEdge(edge)); }
public void TestOneSuccessor() { GraphData g = new GraphData("scope"); INode source = new Node("Source"); INode target = new Node("Target"); Edge edge = new Edge(source, target); g.AddNode(source); g.AddNode(target); g.AddEdge(edge); INode actual = g.Successors(source).First(); Assert.AreEqual <INode>(target, actual); }
public void TestSetUp() { m_Graph = new GraphData(); m_NodeA = new TestNode(); m_NodeA.precision = Precision.Half; m_Graph.AddNode(m_NodeA); }
public void TestSetUp() { m_Graph = new GraphData(); m_NodeA = new TestNode(); m_Graph.AddNode(m_NodeA); m_NodeA.SetOverrideActiveState(AbstractMaterialNode.ActiveState.ExplicitActive); }
public void TestSetUp() { m_Graph = new GraphData(); m_NodeA = new TestNode(); m_NodeA.precision = AbstractMaterialNode.OutputPrecision.half; m_Graph.AddNode(m_NodeA); }
public bool OnSelectEntry(SearchTreeEntry entry, SearchWindowContext context) { var nodeEntry = (NodeEntry)entry.userData; var node = nodeEntry.node; var drawState = node.drawState; var windowRoot = m_EditorWindow.rootVisualElement; var windowMousePosition = windowRoot.ChangeCoordinatesTo(windowRoot.parent, context.screenMousePosition - m_EditorWindow.position.position); var graphMousePosition = m_GraphView.contentViewContainer.WorldToLocal(windowMousePosition); drawState.position = new Rect(graphMousePosition, Vector2.zero); node.drawState = drawState; m_Graph.owner.RegisterCompleteObjectUndo("Add " + node.name); m_Graph.AddNode(node); if (connectedPort != null) { var connectedSlot = connectedPort.slot; var connectedSlotReference = connectedSlot.owner.GetSlotReference(connectedSlot.id); var compatibleSlotReference = node.GetSlotReference(nodeEntry.compatibleSlotId); var fromReference = connectedSlot.isOutputSlot ? connectedSlotReference : compatibleSlotReference; var toReference = connectedSlot.isOutputSlot ? compatibleSlotReference : connectedSlotReference; m_Graph.Connect(fromReference, toReference); nodeNeedsRepositioning = true; targetSlotReference = compatibleSlotReference; targetPosition = graphMousePosition; } return(true); }
public void AddNodeToGraph(AbstractMaterialNode node) { if (!_graph.ContainsNodeGuid(node.guid)) { _graph.AddNode(node); } }
public override void Action(int instanceId, string pathName, string resourceFile) { var graph = new GraphData(); graph.AddNode(new FabricMasterNode()); File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph)); AssetDatabase.Refresh(); }
public override void Action(int instanceId, string pathName, string resourceFile) { var graph = new GraphData(); graph.AddNode(new CustomRenderTextureNode()); graph.path = "Shader Graphs"; File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph)); AssetDatabase.Refresh(); }
public void TestAddingNode() { GraphData g = new GraphData("scope"); Node node = new Node("Node1"); g.AddNode(node); Assert.IsTrue(g.ContainsNode(node)); }
public void TestCanConnectAndTraverseThreeNodesOnBaseMaterialGraph() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var middleNode = new TestableNode(); graph.AddNode(middleNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(3, graph.GetNodes <AbstractMaterialNode>().Count()); graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), middleNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); graph.Connect(middleNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(2, graph.edges.Count()); var edgesOnMiddleNode = NodeUtils.GetAllEdges(middleNode); Assert.AreEqual(2, edgesOnMiddleNode.Count()); outputNode.SetOverrideActiveState(AbstractMaterialNode.ActiveState.ExplicitActive); middleNode.SetOverrideActiveState(AbstractMaterialNode.ActiveState.ExplicitActive); inputNode.SetOverrideActiveState(AbstractMaterialNode.ActiveState.ExplicitActive); List <AbstractMaterialNode> result = new List <AbstractMaterialNode>(); NodeUtils.DepthFirstCollectNodesFromNode(result, inputNode); Assert.AreEqual(3, result.Count); result.Clear(); NodeUtils.DepthFirstCollectNodesFromNode(result, inputNode, NodeUtils.IncludeSelf.Exclude); Assert.AreEqual(2, result.Count); result.Clear(); NodeUtils.DepthFirstCollectNodesFromNode(result, null); Assert.AreEqual(0, result.Count); }
public void TestCanGetEdgesOnBaseMaterialGraphFromSlotReference() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); Assert.AreEqual(1, graph.GetEdges(inputNode.GetSlotReference(TestableNode.Input0)).Count()); Assert.AreEqual(1, graph.GetEdges(outputNode.GetSlotReference(TestableNode.Output0)).Count()); Assert.Throws <ArgumentException>(() => outputNode.GetSlotReference(666)); }
public void TestRemovingEdgeOnBaseMaterialGraph() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); graph.RemoveEdge(graph.edges.FirstOrDefault()); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); Assert.AreEqual(0, graph.edges.Count()); }
public void TestCanNotConnectTwoInputSlotsOnBaseMaterialGraph() { var graph = new GraphData(); var inputNode = new TestableNode(); graph.AddNode(inputNode); var inputNode2 = new TestableNode(); graph.AddNode(inputNode2); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); var createdEdge = graph.Connect(inputNode.GetSlotReference(TestableNode.Input0), inputNode2.GetSlotReference(TestableNode.Input0)); Assert.IsNull(createdEdge); Assert.AreEqual(0, graph.edges.Count()); }
public void TestCanNotConnectToNullSlot() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); var createdEdge2 = graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), new SlotReference(Guid.NewGuid(), 666)); Assert.AreEqual(0, graph.edges.Count()); Assert.IsNull(createdEdge2); }
public void TestRemovingElementsFromBaseMaterialGraph() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); graph.RemoveElements(graph.GetNodes <AbstractMaterialNode>(), graph.edges, Enumerable.Empty <GroupData>()); Assert.AreEqual(0, graph.GetNodes <AbstractMaterialNode>().Count()); Assert.AreEqual(0, graph.edges.Count()); }
public void TestCanAddMaterialNodeToMaterialGraph() { GraphData graph = new GraphData(); var node = new TestableMNode(); graph.AddNode(node); Assert.AreEqual(0, graph.edges.Count()); Assert.AreEqual(1, graph.GetNodes <AbstractMaterialNode>().Count()); }
public void TestMultipleSuccessors() { GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Node superTarget = new Node("SuperTarget"); Edge edge1 = new Edge(source, target); Edge edge2 = new Edge(target, superTarget); List <INode> predecessors; g.AddNode(source); g.AddNode(target); g.AddNode(superTarget); g.AddEdge(edge1); g.AddEdge(edge2); predecessors = new List <INode>(g.Successors(source)); Assert.IsTrue(predecessors.Contains(target)); }
public void TestRemovingSlotRemovesConnectedEdges() { var graph = new GraphData(); var outputNode = new TestableNode(); graph.AddNode(outputNode); var inputNode = new TestableNode(); graph.AddNode(inputNode); Assert.AreEqual(2, graph.GetNodes <AbstractMaterialNode>().Count()); graph.Connect(outputNode.GetSlotReference(TestableNode.Output0), inputNode.GetSlotReference(TestableNode.Input0)); Assert.AreEqual(1, graph.edges.Count()); outputNode.RemoveSlot(TestableNode.Output0); Assert.AreEqual(0, graph.edges.Count()); }
public void TestCanNotRemoveNoDeleteNodeFromBaseMaterialGraph() { var graph = new GraphData(); var node = new NoDeleteNode(); node.name = "Test Node"; graph.AddNode(node); Assert.AreEqual(1, graph.GetNodes <AbstractMaterialNode>().Count()); Assert.Catch <InvalidOperationException>(() => graph.RemoveNode(node)); Assert.AreEqual(1, graph.GetNodes <AbstractMaterialNode>().Count()); }
public void TestCanFindNodeInBaseMaterialGraph() { var graph = new GraphData(); var node = new TestNode(); graph.AddNode(node); Assert.AreEqual(1, graph.GetNodes <AbstractMaterialNode>().Count()); Assert.IsNotNull(graph.GetNodeFromGuid(node.guid)); Assert.IsNull(graph.GetNodeFromGuid(Guid.NewGuid())); }
public void Verify_Edge_Added_To_Physical_Graph_Once_All_Corresponding_Target_Nodes_Added() { int actualSourceEdges; int actualTargetEdges; int expectedSourceEdges = 1; int expectedTargetEdges = 1; INode temp1 = new Node("temp1"); // Hack because an exception is thrown if you attempt to add an edge to a graph if the graph doesn't have at least one node INode source = PrepareNode("Node1", ghostNode: true); INode target = PrepareNode("Node2", ghostNode: true); IEdge orphan = new Edge(source, target); IEdge actualSource; IEdge actualTarget; GraphData graphData = new GraphData("scope"); // Hack (see temp1 comment above) graphData.AddNode(temp1); // Add an edge with ghost nodes to the graph graphData.AddEdge(orphan); // Add the missing node source = PrepareNode("Node1", ghostNode: false); target = PrepareNode("Node2", ghostNode: false); graphData.AddNode(source); graphData.AddNode(target); // Get the actual count for nodes actualSourceEdges = graphData.Edges(source).Count(); actualTargetEdges = graphData.Edges(target).Count(); actualSource = graphData.Edges(source).FirstOrDefault(); actualTarget = graphData.Edges(target).FirstOrDefault(); Assert.AreEqual(expectedSourceEdges, actualSourceEdges); Assert.AreEqual(expectedTargetEdges, actualTargetEdges); Assert.AreEqual(orphan, actualSource); Assert.AreEqual(orphan, actualTarget); }
public void TestOneSuccessor() { GraphData g = new GraphData("scope"); INode source = new Node("Source"); INode target = new Node("Target"); Edge edge = new Edge(source, target); g.AddNode(source); g.AddNode(target); g.AddEdge(edge); INode actual = g.Successors(source).First(); Assert.AreEqual<INode>(target, actual); }
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 TestRemoveNode() { GraphData g = new GraphData("scope"); Node node = new Node("Node"); g.AddNode(node); if (!g.ContainsNode(node)) { Assert.Inconclusive("Node wasn't found in collection after adding it. Verify Add() functionality."); } // Remove the Node g.RemoveNode(node); // Make sure the Node has been removed Assert.IsFalse(g.ContainsNode(node)); }
public void Verify_Edge_Added_To_Physical_Graph_Once_Corresponding_Source_Node_Added() { int actualSourceEdges; int actualTargetEdges; int expectedSourceEdges = 1; int expectedTargetEdges = 1; INode source = PrepareNode("Node1", ghostNode: true); INode target = PrepareNode("Node2", ghostNode: false); IEdge orphan = new Edge(source, target); GraphData graphData = new GraphData("scope"); // Add an edge with ghost nodes to the graph graphData.AddNode(target); graphData.AddEdge(orphan); // Add the missing node source = PrepareNode("Node1", ghostNode: false); graphData.AddNode(source); // Get the actual count for nodes actualSourceEdges = graphData.Edges(source).Count(); actualTargetEdges = graphData.Edges(target).Count(); Assert.AreEqual(expectedSourceEdges, actualSourceEdges); Assert.AreEqual(expectedTargetEdges, actualTargetEdges); }
public void Verify_Edge_With_Two_Ghost_Nodes_Not_Added_To_Physical_Graph() { IEnumerable<IEdge> actualSourceEdges; IEnumerable<IEdge> actualTargetEdges; IEnumerable<IEdge> expectedSourceEdges = null; IEnumerable<IEdge> expectedTargetEdges = null; INode temp1 = new Node("temp1"); // Hack because an exception is thrown if you attempt to add an edge to a graph if the graph doesn't have at least one node INode source = PrepareNode("Node1", ghostNode: true); INode target = PrepareNode("Node2", ghostNode: true); IEdge orphan = new Edge(source, target); GraphData graphData = new GraphData("scope"); graphData.AddNode(temp1); // Hack (see temp1 comment above) // Add an edge with ghost nodes to the graph graphData.AddEdge(orphan); // Get the actual count for nodes actualSourceEdges = graphData.Edges(source); actualTargetEdges = graphData.Edges(target); Assert.AreEqual(expectedSourceEdges, actualSourceEdges); Assert.AreEqual(expectedTargetEdges, actualTargetEdges); }
public void Verify_Edge_With_No_Ghost_Nodes_Is_Added_To_Physical_Graph() { int actualSourceEdges; int actualTargetEdges; int expectedSourceEdges = 1; int expectedTargetEdges = 1; INode source = PrepareNode("Node1", ghostNode: false); INode target = PrepareNode("Node2", ghostNode: false); IEdge edge = new Edge(source, target); GraphData graphData = new GraphData("scope"); // Add an edge without ghost nodes to the graph graphData.AddNode(source); graphData.AddNode(target); graphData.AddEdge(edge); // Get the actual count for nodes actualSourceEdges = graphData.Edges(source).Count(); actualTargetEdges = graphData.Edges(target).Count(); Assert.AreEqual(expectedSourceEdges, actualSourceEdges); Assert.AreEqual(expectedTargetEdges, actualTargetEdges); }
public void TestRemovingEdgeFiresCollectionChangedEvent() { SnaglEventAggregator eventAggregator = SnaglEventAggregator.DefaultInstance; GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Edge edge = new Edge(source, target); g.AddNode(source); g.AddNode(target); g.AddEdge(edge); // Don't replace this with a lambda eventAggregator.GetEvent<EdgeRemovedEvent>().Subscribe(OnEdgeRemoved); EnqueueCallback(() => g.RemoveEdge(edge)); EnqueueConditional(() => _eventFired); EnqueueCallback(() => Assert.IsTrue(_eventFired)); EnqueueCallback(() => Assert.AreEqual<IEdge>(edge, _affectedEdge)); EnqueueTestComplete(); }
public void TestAddingEdgeFiresCollectionChangedEvent() { bool eventFired = false; NotifyCollectionChangedAction action = NotifyCollectionChangedAction.Reset; GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Edge edge = new Edge(source, target); // TODO: This test is invalid because added Node objects to the collection will fire the same event g.CollectionChanged += (sender, e) => { action = e.Action; eventFired = true; }; EnqueueCallback(() => g.AddNode(source)); EnqueueCallback(() => g.AddNode(target)); EnqueueCallback(() => g.AddEdge(edge)); EnqueueConditional(() => eventFired); EnqueueCallback(() => Assert.IsTrue(eventFired)); EnqueueCallback(() => Assert.AreEqual<NotifyCollectionChangedAction>(NotifyCollectionChangedAction.Add, action)); EnqueueTestComplete(); }
public void TestMultipleSuccessors() { GraphData g = new GraphData("scope"); Node source = new Node("Source"); Node target = new Node("Target"); Node superTarget = new Node("SuperTarget"); Edge edge1 = new Edge(source, target); Edge edge2 = new Edge(target, superTarget); List<INode> predecessors; g.AddNode(source); g.AddNode(target); g.AddNode(superTarget); g.AddEdge(edge1); g.AddEdge(edge2); predecessors = new List<INode>(g.Successors(source)); Assert.IsTrue(predecessors.Contains(target)); }
public void TestCollectionChangedEventFiredWhenNodeAdded() { bool eventFired = false; NotifyCollectionChangedAction action = NotifyCollectionChangedAction.Reset; GraphData g = new GraphData("scope"); Node node = new Node("Node1"); g.CollectionChanged += (sender, e) => { action = e.Action; eventFired = true; }; EnqueueCallback(() => g.AddNode(node)); EnqueueConditional(() => eventFired); EnqueueCallback(() => Assert.IsTrue(eventFired)); EnqueueCallback(() => Assert.AreEqual<NotifyCollectionChangedAction>(NotifyCollectionChangedAction.Add, action)); EnqueueTestComplete(); }
public void TestContainsNode() { GraphData g = new GraphData("scope"); Node node = new Node("Node1"); g.AddNode(node); Assert.IsTrue(g.ContainsNode(node)); }