private void FillWriter(ref AbstractWriter writer, DateTime startedAt, DateTime endedAt) { writer.SetCompletedTasks(Requests). SetEndedAtTime(endedAt) .SetStartedAtTime(startedAt) .SetStopReason(src.Entities.StopSignal.Manual); writer.Write(); }
public void Run(RunTestDto dto) { Validate(dto); if (HaveValidationErrors()) { PrintValidationErrors(); return; } Executor.SetConfig(dto.GetTestConfig()); Executor.Configurate(); Task session = Task.Run(() => { Executor.StartTest(); }); bool manualyStopped = false; while (!session.IsCompleted) { ConsoleKeyInfo key = Console.ReadKey(); if (key.KeyChar == STOP) { Executor.StopExecution(); manualyStopped = true; break; } } List <RequestTask> result = Executor.GetResult(); if (result.Count == 0) { return; } AbstractWriter writer = WritersFactory.GetWriter(dto.ResultWriter); writer.SetCompletedTasks(result) .SetStartedAtTime(Executor.GetStartedAt()) .SetEndedAtTime(DateTime.Now) .SetStopReason(manualyStopped ? StopSignal.Manual : dto.StopSignal); writer.Write(); }