public void TryGetAllLoggedDayGroups_NewTrackerId_ReturnsEmpty() { // arrange var service = new TrackerLogService(_database, _logger); int trackerId = 100; // act var groups = service .TryGetAllLoggedDayGroups(LoggedDays, trackerId, GroupSortOption.DateDescending); // assert Assert.Empty(groups); }
public void TryGetAllLoggedDayGroups_IgnoresTimeDifferences() { // arrange var service = new TrackerLogService(_database, _logger); int trackerId = 4; // act var groups = service .TryGetAllLoggedDayGroups(LoggedDays, trackerId, GroupSortOption.DateDescending); // assert Assert.Single(groups); }
public void TryGetAllLoggedDayGroups_GroupsByDay() { // arrange var service = new TrackerLogService(_database, _logger); int trackerId = 1; // act var groups = service .TryGetAllLoggedDayGroups(LoggedDays, trackerId, GroupSortOption.DateDescending); var duplicateDate = groups.First(group => group.Date == new DateTime(2020, 1, 1)); // assert Assert.Equal(2, duplicateDate.Count); Assert.Equal(3, groups.Count()); // 3 items in the list overall because the duplicates should count as 1 }
public void TryGetAllLoggedDayGroups_CountDescending_IsInCountDescendingOrder() { // arrange var service = new TrackerLogService(_database, _logger); int trackerId = 1; // act var actual = service .TryGetAllLoggedDayGroups(LoggedDays, trackerId, GroupSortOption.CountDescending) .ToList(); var expected = actual.OrderByDescending(group => group.Count).ToList(); // assert Assert.Equal(expected, actual); }