public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException() { // Arrange var mockCookieProvider = MockCookieProvider(); var criteria = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object); // Act criteria.MatchesVisitor((string)null); }
public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException() { // Arrange var mockCookieProvider = MockCookieProvider(); var criteria = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object); // Act Assert.Throws <ArgumentNullException>(() => criteria.MatchesVisitor(null)); }
public void CookiePersonalisationGroupCriteria_MatchesVisitor_WithInvalidDefinition_ThrowsException() { // Arrange var mockCookieProvider = MockCookieProvider(); var criteria = new CookiePersonalisationGroupCriteria(mockCookieProvider.Object); var definition = "invalid"; // Act criteria.MatchesVisitor(definition); }
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); }
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); }
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); }
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); }
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); }