public void ReturnsTaskProgressIfJobPlanExecutionStateIsInProgress() { DateTime now = new DateTime(2001, 01, 01, 12, 0, 0, DateTimeKind.Utc); DateTime task1Start = new DateTime(2001, 01, 01, 11, 30, 0, DateTimeKind.Utc); DateTime task2Start = new DateTime(2001, 01, 01, 12, 30, 0, DateTimeKind.Utc); VirtualTimeProvider TimeProvider = new VirtualTimeProvider(now); var job = CreateJobWithLongPlan(task1Start, task2Start, ExecutionState.Running, ExecutionState.Queued, ExecutionState.Queued); List <TaskProgress> result = MappingHelper.CalculateTaskPercentDone(job, TimeProvider); Assert.That(result[0].PercentDone, Is.EqualTo(50), "task 1 percent done is wrong"); Assert.That(result[0].PercentOfTotal, Is.EqualTo(33), "task 1 percent total is wrong"); Assert.That(result[0].Name, Is.EqualTo("foo"), "task 1 name is wrong"); Assert.That(result[1].PercentDone, Is.EqualTo(0), "task 2 percent done is wrong"); Assert.That(result[1].PercentOfTotal, Is.EqualTo(66), "task 2 percent total is wrong"); Assert.That(result[1].Name, Is.EqualTo("bar"), "task 2 name is wrong"); }
public void OneTimeSetUp() { startTime = new DateTime(2001, 1, 1).ToUniversalTime(); timeProvider = new VirtualTimeProvider(startTime); }