public void ExecuteGraph_Should_Succeed_WithGraphAsset() { var graphType = Substitute.For <IExecutableGraphType <string> >(); var graph = new GraphModel(graphType); var nodeType = new SourceNode("test"); var node = nodeType.CreateNode(); graph.AddNode(node); var graphAsset = GraphAsset.Create(graph); var args = "test"; var result = GraphExecutor.ExecuteGraph(graphAsset, args); Assert.That(result, Is.Not.Null); graphType.Received().Execute(graph, args); }
public void ExecuteGraphAsync_Should_Succeed_WithGraphAsset() { var graphType = Substitute.For <IExecutableAsyncGraphType <string> >(); graphType.ExecuteAsync(Arg.Any <GraphModel>(), Arg.Any <string>()).Returns(Task.FromResult(Substitute.For <IGraphExecutionResult>())); var graph = new GraphModel(graphType); var nodeType = new SourceNode("test"); var node = nodeType.CreateNode(); graph.AddNode(node); var graphAsset = GraphAsset.Create(graph); var args = "test"; var result = GraphExecutor.ExecuteGraphAsync(graphAsset, args); Assert.That(result, Is.Not.Null); graphType.Received().ExecuteAsync(graph, args); }