public void TimeManager_GetPersonTasksWithTime_CustomTasksAndJiraTasks_TimeShouldBeEqual(int daysCount, int jiraTasksCount, int customTaskCount) { var days = new WorkDayFactory().GetWorkDays(Year, Month, daysCount); var jiraTasks = new TaskFactory().GetJiraTasks(jiraTasksCount); var customTasks = new TaskFactory().GetCustomTasks(days, customTaskCount); var personTasks = new List<PersonTask>(); personTasks.AddRange(jiraTasks); personTasks.AddRange(customTasks); var personWorkMonth = TimeManager_GetPersonWorkMonthWithoutData(); personWorkMonth.PersonTasks = personTasks; personWorkMonth.WorkDays = days; var timeManager = new PersonTimeManager(new TimeSpan(8, 0, 0)); personWorkMonth.PersonTasks = timeManager.GetPersonTasksWithTime(personWorkMonth.PersonTasks, personWorkMonth.WorkDays); var workMonthHelper = new WorkMonthHelper(); var actualResult = workMonthHelper.ActualWorkTime(personWorkMonth).Ticks; var expectedResult = workMonthHelper.FullWorkTime(personWorkMonth).Ticks; var actualCustomTasks = personWorkMonth.PersonTasks.Where(t => t is CustomPersonTask).ToList(); Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(daysCount, personWorkMonth.WorkDays.Count); Assert.AreEqual(customTaskCount, actualCustomTasks.Count); foreach (var personTask in personWorkMonth.PersonTasks) { Assert.IsTrue(personTask.Hours > TimeSpan.Zero); } foreach (var customTask in actualCustomTasks) { var expectedCustomTask = customTasks.Single(t => t.Id == customTask.Id); Assert.AreEqual(expectedCustomTask.Hours.Value, customTask.Hours.Value); Assert.AreEqual(expectedCustomTask.Hours.Value, customTask.Hours.Value); Assert.AreEqual(expectedCustomTask.StartTime.Value, customTask.StartTime.Value); } }
public void TimeManager_GetPersonTasksWithTime_DaysAndTasks_TimeShouldBeEqual(int daysCount, int tasksCount) { var personWorkMonth = TimeManager_GetPersonWorkMonthWithData(daysCount, tasksCount); var workMonthHelper = new WorkMonthHelper(); var actualResult = workMonthHelper.ActualWorkTime(personWorkMonth).Ticks; var expectedResult = workMonthHelper.FullWorkTime(personWorkMonth).Ticks; Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(daysCount, personWorkMonth.WorkDays.Count); foreach (var personTask in personWorkMonth.PersonTasks) { Assert.IsTrue(personTask.Hours > TimeSpan.Zero); } }
public void TimeManager_GetPersonTasksWithTime_ZeroDaysManyTasks_TimeShouldBeNotEqual(int tasksCount) { const int daysCount = 0; const int tasksCountExpected = 0; var personWorkMonth = TimeManager_GetPersonWorkMonthWithData(daysCount, tasksCount); var workMonthHelper = new WorkMonthHelper(); var actualResult = workMonthHelper.ActualWorkTime(personWorkMonth).Ticks; var expectedResult = workMonthHelper.FullWorkTime(personWorkMonth).Ticks; Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(tasksCountExpected, personWorkMonth.PersonTasks.Count); Assert.AreEqual(daysCount, personWorkMonth.WorkDays.Count); }