public void FindMostOverlappingParties_NullInput_ThrowsException() { // Arrange // Act void action() => OverlappingParties.FindMostOverlappingParties(null); // Assert TestHelpers.AssertExceptionThrown(action, typeof(ArgumentNullException)); }
public void FindMostOverlappingParties_NoParties_ThrowsException() { // Arrange var parties = new List <Party>(); // Act void action() => OverlappingParties.FindMostOverlappingParties(parties); // Assert TestHelpers.AssertExceptionThrown(action, typeof(ArgumentException)); }
public void FindMostOverlappingParties_WithOneParty_ReturnsStartDateOfFirstParty() { // Arrange var parties = new List <Party> { new Party(_janFirst, _janFirst.AddDays(1)) }; // Act var actual = OverlappingParties.FindMostOverlappingParties(parties); // Assert Assert.AreEqual(_janFirst, actual); }
public void FindMostOverlappingParties_InvalidPartyDates_ThrowsException() { // Arrange var parties = new List <Party> { new Party(_janFirst, _janFirst.AddDays(-1)) }; // Act void action() => OverlappingParties.FindMostOverlappingParties(parties); // Assert TestHelpers.AssertExceptionThrown(action, typeof(ArgumentOutOfRangeException)); }
public void FindMostOverlappingParties_WithOverlapAtSameTime_DoesNotReturnOverlap() { // Arrange var parties = new List <Party> { new Party(_janFirst, _janFirst.AddDays(1)), new Party(_janFirst.AddDays(1), _janFirst.AddDays(2)) }; // Act var actual = OverlappingParties.FindMostOverlappingParties(parties); // Assert Assert.AreEqual(_janFirst, actual); }
public void FindMostOverlappingParties_WithTwoDisjointPartyGroups_ReturnsStartDateOfLargerGroup() { // Arrange var parties = new List <Party> { new Party(_janFirst, _janFirst.AddDays(1)), new Party(_janFirst.AddDays(2), _janFirst.AddDays(4)), new Party(_janFirst.AddDays(3), _janFirst.AddDays(5)) }; // Act var actual = OverlappingParties.FindMostOverlappingParties(parties); // Assert Assert.AreEqual(_janFirst.AddDays(3), actual); }