コード例 #1
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);

            // Act
            criteria.MatchesVisitor((string)null);
        }
コード例 #2
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);

            // Act
            Assert.Throws <ArgumentNullException>(() => criteria.MatchesVisitor(null));
        }
コード例 #3
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithInvalidDefinition_ThrowsException()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);
            var definition         = "invalid";

            // Act
            criteria.MatchesVisitor(definition);
        }
コード例 #4
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithDefinitionForCookieMatchingValue_WithMatchingCookie_ReturnsTrue()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);
            var definition         = string.Format(DefinitionFormat, "key", "MatchesValue", "aaa,bbb,ccc");

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

            // Assert
            Assert.IsTrue(result);
        }
コード例 #5
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithDefinitionForCookieAbsent_WithExistingCookie_ReturnsFalse()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);
            var definition         = string.Format(DefinitionFormat, "key", "DoesNotExist", string.Empty);

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

            // Assert
            Assert.IsFalse(result);
        }
コード例 #6
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithDefinitionDoesNotMatchRegex_WithNonMatchingCookie_ReturnsTrue()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);
            var definition         = string.Format(DefinitionFormat, "regexTest", "DoesNotMatchRegex", "[A-Z]");

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

            // Assert
            Assert.IsTrue(result);
        }
コード例 #7
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithDefinitionForLessThanStringValue_WithNonMatchingCookie_ReturnsFalse()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);
            var definition         = string.Format(DefinitionFormat, "stringCompareTest", "LessThanValue", "aaa");

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

            // Assert
            Assert.IsFalse(result);
        }
コード例 #8
0
        public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithDefinitionForGreaterThanNumericValue_WithMatchingCookie_ReturnsTrue()
        {
            // Arrange
            var mockCookieProvider = MockCookieProvider();
            var criteria           = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object);
            var definition         = string.Format(DefinitionFormat, "numericCompareTest", "GreaterThanValue", "3");

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

            // Assert
            Assert.IsTrue(result);
        }