public void TestAction_RemoveOperationForComponentTypeInInstantiateNodeAction([Values] TestingMode mode) { var compType = typeof(Translation).GenerateTypeHandle(Stencil); PrepareGraph(GraphModel); m_InstantiateModel.SetComponentOperation(compType, ComponentOperation.ComponentOperationType.SetComponent); TestPrereqActionPostreq(mode, () => { var model = GraphModel.FindStackedNodeOfType <InstantiateNodeModel>(); Assert.That(model, Is.Not.Null); var componentCount = model.GetEditableComponents().Count(op => op.Type == compType); Assert.That(componentCount, Is.EqualTo(1)); return(new RemoveOperationForComponentTypeInInstantiateNodeAction(model, compType)); }, () => { var model = GraphModel.FindStackedNodeOfType <InstantiateNodeModel>(); Assert.That(model, Is.Not.Null); var componentCount = model.GetEditableComponents().Count(op => op.Type == compType); Assert.That(componentCount, Is.Zero); } ); }
public void TestAction_SetOperationForComponentTypeInCreateEntityNodeAction([Values] TestingMode mode) { var expectedType = typeof(Translation).GenerateTypeHandle(Stencil); PrepareGraph(GraphModel); TestPrereqActionPostreq(mode, () => { var model = GraphModel.FindStackedNodeOfType <CreateEntityNodeModel>(); Assert.That(model, Is.Not.Null); Assert.That(model.GetEditableComponents().Count(th => th == expectedType), Is.Zero); return(new SetOperationForComponentTypeInCreateEntityNodeAction(model, expectedType)); }, () => { var model = GraphModel.FindStackedNodeOfType <CreateEntityNodeModel>(); Assert.That(model, Is.Not.Null); Assert.That(model.GetEditableComponents(), Contains.Item(expectedType)); } ); }
public static InstantiateNodeModel FindInstantiateNodeModel(this GraphModel graph) { return(graph.FindStackedNodeOfType <InstantiateNodeModel>()); }