public void ContinentPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var mockIpProvider = MockIpProvider();
            var mockContinentGeoLocationProvider = MockGeoLocationProvider();
            var criteria = new ContinentPersonalisationGroupCriteria(mockIpProvider.Object, mockContinentGeoLocationProvider.Object);

            // Act
            Assert.Throws <ArgumentNullException>(() => criteria.MatchesVisitor(null));
        }
Ejemplo n.º 2
0
        public void ContinentPersonalisationGroupCriteria_MatchesVisitor_WithEmptyDefinition_ThrowsException()
        {
            // Arrange
            var mockIpProvider = MockIpProvider();
            var mockContinentGeoLocationProvider = MockGeoLocationProvider();
            var criteria = new ContinentPersonalisationGroupCriteria(mockIpProvider.Object, mockContinentGeoLocationProvider.Object);

            // Act
            criteria.MatchesVisitor((string)null);
        }
Ejemplo n.º 3
0
        public void ContinentPersonalisationGroupCriteria_MatchesVisitor_WithInvalidDefinition_ThrowsException()
        {
            // Arrange
            var mockIpProvider = MockIpProvider();
            var mockContinentGeoLocationProvider = MockGeoLocationProvider();
            var criteria   = new ContinentPersonalisationGroupCriteria(mockIpProvider.Object, mockContinentGeoLocationProvider.Object);
            var definition = "invalid";

            // Act
            criteria.MatchesVisitor(definition);
        }
        public void ContinentPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithDifferentContinentListAndNotInCheck_ReturnsTrue()
        {
            // Arrange
            var mockIpProvider = MockIpProvider();
            var mockContinentGeoLocationProvider = MockGeoLocationProvider();
            var criteria   = new ContinentPersonalisationGroupCriteria(mockIpProvider.Object, mockContinentGeoLocationProvider.Object);
            var definition = string.Format(DefinitionFormat, "IsNotLocatedIn", "AF", "AS");

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

            // Assert
            Assert.IsTrue(result);
        }
        public void ContinentPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionWithEmptyContinentLists_ReturnsFalse()
        {
            // Arrange
            var mockIpProvider = MockIpProvider();
            var mockContinentGeoLocationProvider = MockGeoLocationProvider();
            var criteria   = new ContinentPersonalisationGroupCriteria(mockIpProvider.Object, mockContinentGeoLocationProvider.Object);
            var definition = "{ \"match\": \"IsLocatedIn\", \"codes\": [] }";

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

            // Assert
            Assert.IsFalse(result);
        }
        public void ContinentPersonalisationGroupCriteria_MatchesVisitor_WithValidDefinitionForCouldNotBeLocatedWhenCannotLocate_ReturnsTrue()
        {
            // Arrange
            var mockIpProvider = MockIpProvider();
            var mockContinentGeoLocationProvider = MockGeoLocationProvider(canGeolocate: false);
            var criteria   = new ContinentPersonalisationGroupCriteria(mockIpProvider.Object, mockContinentGeoLocationProvider.Object);
            var definition = "{ \"match\": \"CouldNotBeLocated\", \"codes\": [] }";

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

            // Assert
            Assert.IsTrue(result);
        }