public void Run_IsStoppedIfFailIsFalse_CantExecuteAll() { List <string> taskNames = new List <string>(); TaskRunner runner1 = new TaskRunner("Test1", () => { taskNames.Add("Test1"); }); TaskRunner runner2 = new TaskRunner("Test2", () => { taskNames.Add("Test2"); throw new Exception("Test2"); }); TaskRunner runner3 = new TaskRunner("Test3", () => { taskNames.Add("Test3"); }); BulkTaskRunner runners = new BulkTaskRunner("BulkTest", true); runners.AddRange(runner1, runner2, runner3); Action actual = () => runners.Run(); actual.Should().Throw <Exception>() .WithMessage("Test2"); taskNames.Should() .Contain(runner1.TaskInfo.Name) .And.Contain(runner2.TaskInfo.Name) .And.NotContain(runner3.TaskInfo.Name) .And.HaveCount(2); }
public void GuidIndexer_IsExisting_取得TaskRunner() { TaskRunner runner1 = new TaskRunner("Test1", () => { }); TaskRunner runner2 = new TaskRunner("Test2", () => { }); runners.AddRange(runner1, runner2); ITaskRunner runner3 = runners[runner1.TaskInfo.Id]; ITaskRunner runner4 = runners[runner2.TaskInfo.Id]; runner3.Should().Be(runner1); runner4.Should().Be(runner2); }