public void Executing_an_operation_calls_the_OnExecute_method() { var sut = new FakeOperation(); sut.Execute(); Assert.True(sut.HasExecuted); }
public void Executed_child_operations_are_added_to_the_execution_info_list(IOperation childOperation) { var sut = new FakeOperation(childOperation); sut.Execute(); Assert.Equal(1, sut.ExecutedChildOperations.Count()); Assert.Equal(childOperation, sut.ExecutedChildOperations.ElementAt(0).Operation); }
public void You_can_make_data_available_to_child_operations(object input) { var childInputOperation = new FakeInputOperation <object>(); var sut = new FakeOperation(childInputOperation); sut.ExecuteAction = () => sut.PublicPipeInputToChildOperations(input); sut.Execute(); Assert.Equal(input, childInputOperation.ProvidedInput); }
public void Data_flows_between_child_operations_from_interface_input_and_output(object output) { var inputOperation = new FakeInputOperation <object>(); var outpuOperation = new FakeOutputOperation <object> { OutputValue = output }; var sut = new FakeOperation(outpuOperation, inputOperation); sut.Execute(); Assert.Equal(outpuOperation.OutputValue, inputOperation.ProvidedInput); }
public void Outputs_can_be_piped_to_parent_operations(object output) { var innerOutputOperation = new TestOutputOperation { Output = output }; var outputOperation = new TestPipedOutputOperation(innerOutputOperation); var op = new FakeOperation(outputOperation); op.Execute(); Assert.Same(output, outputOperation.Output); }
public void Executing_an_operation_executes_each_child_operation_as_well() { var op1 = new FakeOperation(); var op2 = new FakeOperation(); var sut = new FakeOperation(op1, op2); sut.Execute(); Assert.Equal(3, FakeOperation.ExecutedOperations.Count); Assert.Equal(sut, FakeOperation.ExecutedOperations[0]); Assert.Equal(op1, FakeOperation.ExecutedOperations[1]); Assert.Equal(op2, FakeOperation.ExecutedOperations[2]); }
public void Input_data_flow_is_cut_off_from_child_operations_if_not_consumed_by_parent_operation(object output) { var outputOperation = new FakeOutputOperation <object> { OutputValue = output }; var childInputOperation = new FakeInputOperation <object>(); var parentInputOperation = new FakeOperation(childInputOperation); var sut = new FakeOperation(outputOperation, parentInputOperation); sut.Execute(); Assert.Null(childInputOperation.ProvidedInput); }
public void Input_propery_data_automatically_flows_to_child_operations_when_consumed_in_parent_operation(object output) { var outputOperation = new FakeOutputOperation <object> { OutputValue = output }; var childInputOperation = new TestPropertyInputOperation(); var parentInputOperation = new TestPropertyInputOperation(childInputOperation); var sut = new FakeOperation(outputOperation, parentInputOperation); sut.Execute(); Assert.Equal(outputOperation.OutputValue, childInputOperation.Input); }
public void Data_flows_between_child_operations_from_property_input_and_output(object data) { var inputOperation = new TestPropertyInputOperation(); var outputOperation = new TestPropertyOutputOperation(inputOperation) { Output = data }; var sut = new FakeOperation(outputOperation, inputOperation); sut.Execute(); Assert.Equal(data, outputOperation.Output); Assert.Equal(data, inputOperation.Input); }
public void Gettting_executed_operations_for_hierarchy_returns_all_executed_tasks_in_the_order_executed(IOperation grandChildOperation, IOperation childOperation2) { var childOperation1 = new FakeOperation(grandChildOperation); var sut = new FakeOperation(childOperation1, childOperation2); sut.Execute(); var executions = sut.GetExecutedChildOperationsForOperationHierarchy(); Assert.Equal(3, executions.Count); Assert.Equal(childOperation1, executions[0].Operation); Assert.Equal(grandChildOperation, executions[1].Operation); Assert.Equal(childOperation2, executions[2].Operation); }
public void Inputs_can_be_piped_to_child_operations(object input) { var innerInputOperation = new TestInputOperation(); var inputOperation = new TestPipedInputOperation(innerInputOperation) { Input = input }; var op = new FakeOperation(inputOperation); var sut = OperationContext.Create(op); sut.AddData(input); op.Execute(); Assert.Same(input, innerInputOperation.Input); }
public void Child_execution_info_contains_the_start_and_end_times_of_the_execution() { var childOperation = new FakeOperation { ExecuteAction = () => Time.Wait(TimeSpan.FromSeconds(1)) }; var sut = new FakeOperation(childOperation); Time.Stop(); var started = Time.OffsetUtcNow; sut.Execute(); var executionInfo = sut.ExecutedChildOperations.ElementAt(0); Assert.Equal(started, executionInfo.Started); Assert.Equal(started.AddSeconds(1), executionInfo.Completed); }