Пример #1
0
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var criteria = new DayOfWeekPersonalisationGroupCriteria();

            // Act
            criteria.MatchesVisitor((string)null);
        }
Пример #2
0
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithInvalidDefinition_ThrowsException()
        {
            // Arrange
            var criteria   = new DayOfWeekPersonalisationGroupCriteria();
            var definition = "invalid";

            // Act
            criteria.MatchesVisitor(definition);
        }
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var mockDateTimeProvider = MockDateTimeProvider();
            var criteria             = new DayOfWeekPersonalisationGroupCriteria(mockDateTimeProvider.Object);

            // Act
            criteria.MatchesVisitor((string)null);
        }
Пример #4
0
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var mockDateTimeProvider = MockDateTimeProvider();
            var criteria             = new DayOfWeekPersonalisationGroupCriteria(mockDateTimeProvider.Object);

            // Act
            Assert.Throws <ArgumentNullException>(() => criteria.MatchesVisitor(null));
        }
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithInvalidDefinition_ThrowsException()
        {
            // Arrange
            var mockDateTimeProvider = MockDateTimeProvider();
            var criteria             = new DayOfWeekPersonalisationGroupCriteria(mockDateTimeProvider.Object);
            var definition           = "invalid";

            // Act
            criteria.MatchesVisitor(definition);
        }
Пример #6
0
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithEmptyDays_ReturnsFalse()
        {
            // Arrange
            var criteria   = new DayOfWeekPersonalisationGroupCriteria();
            var definition = "[]";

            // Act
            var result = criteria.MatchesVisitor(definition);

            // Assert
            Assert.IsFalse(result);
        }
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithMatchingDays_ReturnsTrue()
        {
            // Arrange
            var mockDateTimeProvider = MockDateTimeProvider();
            var criteria             = new DayOfWeekPersonalisationGroupCriteria(mockDateTimeProvider.Object);
            var definition           = string.Format(DefinitionFormat, 6, 7); // Friday, Saturday

            // Act
            var result = criteria.MatchesVisitor(definition);

            // Assert
            Assert.IsTrue(result);
        }
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithDifferentDays_ReturnsFalse()
        {
            // Arrange
            var mockDateTimeProvider = MockDateTimeProvider();
            var criteria             = new DayOfWeekPersonalisationGroupCriteria(mockDateTimeProvider.Object);
            var definition           = string.Format(DefinitionFormat, 2, 3); // Monday, Tuesday

            // Act
            var result = criteria.MatchesVisitor(definition);

            // Assert
            Assert.IsFalse(result);
        }
Пример #9
0
        public void DayOfWeekPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithMatchingDays_ReturnsTrue()
        {
            // Arrange
            var criteria   = new DayOfWeekPersonalisationGroupCriteria();
            var definition = string.Format(DefinitionFormat,
                                           GetDayOfWeekAsInteger(DateTime.Now),
                                           GetDayOfWeekAsInteger(DateTime.Now.AddDays(1)));

            // Act
            var result = criteria.MatchesVisitor(definition);

            // Assert
            Assert.IsTrue(result);
        }