public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException() { // Arrange var criteria = new TimeOfDayPersonalisationGroupCriteria(); // Act criteria.MatchesVisitor((string)null); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithInvalidDefinition_ThrowsException() { // Arrange var criteria = new TimeOfDayPersonalisationGroupCriteria(); var definition = "invalid"; // Act criteria.MatchesVisitor(definition); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException() { // Arrange var mockDateTimeProvider = MockDateTimeProvider(); var criteria = new TimeOfDayPersonalisationGroupCriteria(mockDateTimeProvider.Object); // Act Assert.Throws <ArgumentNullException>(() => criteria.MatchesVisitor(null)); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException() { // Arrange var mockDateTimeProvider = MockDateTimeProvider(); var criteria = new TimeOfDayPersonalisationGroupCriteria(mockDateTimeProvider.Object); // Act criteria.MatchesVisitor((string)null); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithEmptyDays_ReturnsFalse() { // Arrange var criteria = new TimeOfDayPersonalisationGroupCriteria(); var definition = "[]"; // Act var result = criteria.MatchesVisitor(definition); // Assert Assert.IsFalse(result); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithMatchingTimePeriodsInLastMinute_ReturnsTrue() { // Arrange var mockDateTimeProvider = MockDateTimeProvider(new DateTime(2016, 1, 1, 23, 59, 59)); var criteria = new TimeOfDayPersonalisationGroupCriteria(mockDateTimeProvider.Object); var definition = string.Format(DefinitionFormat, "0900", "0930", "2300", "2359"); // Act var result = criteria.MatchesVisitor(definition); // Assert Assert.IsTrue(result); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithMatchingTimePeriods_ReturnsTrue() { // Arrange var mockDateTimeProvider = MockDateTimeProvider(); var criteria = new TimeOfDayPersonalisationGroupCriteria(mockDateTimeProvider.Object); var definition = string.Format(DefinitionFormat, "0900", "1015", "1100", "1130"); // Act var result = criteria.MatchesVisitor(definition); // Assert Assert.IsTrue(result); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithDifferentTimePeriods_ReturnsFalse() { // Arrange var criteria = new TimeOfDayPersonalisationGroupCriteria(); var definition = string.Format(DefinitionFormat, DateTime.Now.AddHours(2).ToString("HHmm"), DateTime.Now.AddHours(2).AddMinutes(30).ToString("HHmm"), DateTime.Now.AddHours(4).ToString("HHmm"), DateTime.Now.AddHours(4).AddMinutes(30).ToString("HHmm")); // Act var result = criteria.MatchesVisitor(definition); // Assert Assert.IsFalse(result); }
public void TimeOfDayPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithMatchingTimePeriods_ReturnsTrue() { // Arrange var criteria = new TimeOfDayPersonalisationGroupCriteria(); var definition = string.Format(DefinitionFormat, DateTime.Now.AddMinutes(-1).ToString("HHmm"), DateTime.Now.AddMinutes(30).ToString("HHmm"), DateTime.Now.AddHours(4).ToString("HHmm"), DateTime.Now.AddHours(4).AddMinutes(30).ToString("HHmm")); // Act var result = criteria.MatchesVisitor(definition); // Assert Assert.IsTrue(result); }