Esempio 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
        }
Esempio 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);
        }
Esempio 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
        }
Esempio 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
        }
Esempio 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);
        }
Esempio 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);
        }