public void TestVisualScriptingNodesOfType(Type type, bool result) { var filter = new SearcherFilter(SearcherContext.Graph).WithVisualScriptingNodes(type); var data = new NodeSearcherItemData(typeof(SetVariableNodeModel)); Assert.AreEqual(result, filter.ApplyFilters(data)); }
public void TestVisualScriptingNodes() { var filter = new SearcherFilter(SearcherContext.Graph).WithVisualScriptingNodes(); var data = new NodeSearcherItemData(typeof(SetVariableNodeModel)); Assert.IsTrue(filter.ApplyFilters(data)); }
public void TestWithVisualScriptingNodesExcept(Type exception, Type dataType, bool result) { var filter = new SearcherFilter(SearcherContext.Graph).WithVisualScriptingNodesExcept(new [] { exception }); var data = new NodeSearcherItemData(dataType); Assert.AreEqual(result, filter.ApplyFilters(data)); }
public void TestWithVisualScriptingNodesOfTypeInStack(Type nodeType, bool acceptNode, bool result) { var stackMock = new Mock <IStackModel>(); stackMock.Setup(s => s.AcceptNode(It.IsAny <Type>())).Returns(acceptNode); var filter = new SearcherFilter(SearcherContext.Stack).WithVisualScriptingNodes(nodeType, stackMock.Object); var data = new NodeSearcherItemData(typeof(SetVariableNodeModel)); Assert.AreEqual(result, filter.ApplyFilters(data)); }
//TODO simplistic, to improve. static bool IsRelevantMathNode(ValueType valueType, NodeSearcherItemData data) { if (data.Type != typeof(MathNodeModel)) { return(false); } switch (valueType) { case ValueType.Bool: case ValueType.Int: case ValueType.Float: case ValueType.Float2: case ValueType.Float3: case ValueType.Float4: case ValueType.Quaternion: return(true); default: return(false); } }