예제 #1
0
        private void VerifyTestFile(string file, string[] sepparator)
        {
            //Arrange
            var fileContent = File.ReadAllText(file);
            var contents    = fileContent.Split(sepparator, StringSplitOptions.None);
            var csv         = from line in contents
                              select line.Split('#').ToArray();

            var results = new List <string>();

            //Act
            foreach (string[] item in csv)
            {
                if (item.Length == 3)
                {
                    //Arrange
                    var matcher = new MatchesStringMatcher(item[0]);

                    //Act
                    var result = matcher.Match(item[1]);

                    //Assert
                    Assert.AreEqual(Convert.ToBoolean(item[2]), result, item[0] + "-" + item[1]);
                }
            }
        }
예제 #2
0
        public void MatchShouldReturnFalseIfMatchingBoolean()
        {
            //Arrange
            var matcher = new MatchesStringMatcher("^a");

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

            //Assert
            Assert.IsFalse(result);
        }
예제 #3
0
        public void MatchShouldReturnFalseIfMatchingDate()
        {
            //Arrange
            var matcher = new MatchesStringMatcher("^a");

            //Act
            var result = matcher.Match(DateTime.UtcNow);

            //Assert
            Assert.IsFalse(result);
        }
예제 #4
0
        public void MatchShouldReturnFalseOnNonMatchingKey()
        {
            //Arrange
            var matcher = new MatchesStringMatcher("^a");

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

            //Assert
            Assert.IsFalse(result);
        }
예제 #5
0
        public void MatchShouldReturnTrueOnMatchingKey()
        {
            //Arrange
            var matcher = new MatchesStringMatcher("^a");

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

            //Assert
            Assert.IsTrue(result);
        }
예제 #6
0
        public void MatchShouldReturnFalseIfMatchingSet()
        {
            //Arrange
            var matcher = new MatchesStringMatcher("^a");

            //Act
            var keys = new List <string>();

            keys.Add("test1");
            keys.Add("test3");

            var result = matcher.Match(keys);

            //Assert
            Assert.IsFalse(result);
        }