Exemplo n.º 1
0
        public void MatchShouldReturnFalseIfEmptyWhitelist()
        {
            //Arrange
            var toCompare = new List <string>();
            var matcher   = new StartsWithMatcher(toCompare);

            //Act
            var result = matcher.Match(new Key("test1", "test1"));

            //Assert
            Assert.IsFalse(result); //Empty whitelist
        }
Exemplo n.º 2
0
        public void MatchShouldReturnFalseIfMatchingLong()
        {
            //Arrange
            var toCompare = new List <string>();

            toCompare.Add("test1");
            toCompare.Add("test2");
            var matcher = new StartsWithMatcher(toCompare);

            //Act
            var result = matcher.Match(123);

            //Assert
            Assert.IsFalse(result);
        }
Exemplo n.º 3
0
        public void MatchShouldReturnFalseOnNonMatchingKey()
        {
            //Arrange
            var toCompare = new List <string>();

            toCompare.Add("test1");
            toCompare.Add("test2");
            var matcher = new StartsWithMatcher(toCompare);

            //Act
            var result = matcher.Match(new Key("test3end", "test3end"));

            //Assert
            Assert.IsFalse(result); //key not starts with any element of whitelist
        }
Exemplo n.º 4
0
        public void MatchShouldReturnTrueOnMatchingKeyString()
        {
            //Arrange
            var toCompare = new List <string>();

            toCompare.Add("test1");
            toCompare.Add("test2");
            var matcher = new StartsWithMatcher(toCompare);

            //Act
            var result = matcher.Match("test1end");

            //Assert
            Assert.IsTrue(result); //test1end starts with test1
        }
Exemplo n.º 5
0
        public void MatchShouldReturnFalseIfEmptyKey()
        {
            //Arrange
            var toCompare = new List <string>();

            toCompare.Add("test1");
            toCompare.Add("test2");
            var matcher = new StartsWithMatcher(toCompare);

            //Act
            string key    = "";
            var    result = matcher.Match(new Key(key, key));

            //Assert
            Assert.IsFalse(result);
        }
Exemplo n.º 6
0
        public void MatchShouldReturnFalseIfNullKeyString()
        {
            //Arrange
            var toCompare = new List <string>();

            toCompare.Add("test1");
            toCompare.Add("test2");
            var matcher = new StartsWithMatcher(toCompare);

            //Act
            string key    = null;
            var    result = matcher.Match(key);

            //Assert
            Assert.IsFalse(result);
        }