public void A01_GetTaskDurationTest() { Fixture fixture = new Fixture(); var startDate = new DateTime(2015, 10, 1, 12, 00, 00); var endDate = new DateTime(2015, 10, 3, 13, 00, 00); var expectedDuration = new TimeSpan(2, 1, 0, 0); ITask testTask = new TaskModel { Id = 1, Name = fixture.Create<string>(), CreationDate = fixture.Create<DateTime>(), State = TaskState.DONE, StartDate = startDate, DoneDate = endDate }; ITimeReporter reporter = new TimeReporter(); var actualDuration = reporter.GetTaskDuration(testTask); Assert.AreEqual(expectedDuration, actualDuration); }
public void A04_GetSumTaskDurationByOneDateOnly() { var testTaskPhaseSet = testTaskPhaseSetOne; var expectedDuration = new TimeSpan(0, 10, 20); var reporter = new TimeReporter(); var actualDuration = reporter.GetTaskPhasesDuration(testTaskPhaseSet, new DateTime(2015, 10, 03), new DateTime(2015, 10, 04)); Assert.AreEqual(expectedDuration, actualDuration); }
public void A05_GetSumTaskDurationByFateRangePassingNull() { var testTaskPhaseSet = testTaskPhaseSetOne; var expectedDuration = new TimeSpan(1, 2, 50, 20); var reporter = new TimeReporter(); // Pass null instead of fromDate > sum without filter var actualDuration = reporter.GetTaskPhasesDuration(testTaskPhaseSet, null, new DateTime(2015, 10, 04)); Assert.AreEqual(expectedDuration, actualDuration); // Pass null instead of endDate > sum without filter actualDuration = reporter.GetTaskPhasesDuration(testTaskPhaseSet, new DateTime(2015, 10, 03), null); Assert.AreEqual(expectedDuration, actualDuration); // Pass null instead of fromDate and endDate > sum wihtout filter actualDuration = reporter.GetTaskPhasesDuration(testTaskPhaseSet, null, null); Assert.AreEqual(expectedDuration, actualDuration); }
public void A02_GetSumTaskDurationTest() { var testTaskPhaseSet = testTaskPhaseSetOne; var expectedDuration = new TimeSpan(1,2, 50, 20); ITimeReporter reporter = new TimeReporter(); var actualDuration = reporter.GetTaskPhasesDuration(testTaskPhaseSet); Assert.AreEqual(expectedDuration, actualDuration); }