Пример #1
0
        public void WordsStartingWithPrefixTest()
        {
            string         text = "here we go @Jake someday,@Mary,@ joeseph.@";
            IList <string> actual;

            actual = Utils_Accessor.WordsStartingWithPrefix(text, "@", false);
            Assert.AreEqual(2, actual.Count);
            Assert.IsTrue(actual.Any(s => s == "Jake"));
            Assert.IsTrue(actual.Any(s => s == "Mary"));
        }
Пример #2
0
        public void SplitUserInfoTest()
        {
            Name   name    = new Name("Unit Test");
            Email  email   = new Email("*****@*****.**");
            String comment = "Unit Test comment";

            String line = "Unit Test (Unit Test comment) <*****@*****.**>";

            Name   line_name    = null;
            Email  line_email   = null;
            String line_comment = null;

            Utils_Accessor.SplitUserInfo(line, out line_name, out line_email, out line_comment);

            Assert.AreEqual(name, line_name);
            Assert.AreEqual(email, line_email);
            Assert.AreEqual(comment, line_comment);
        }
Пример #3
0
        public void FindSentenceContainingTestValid()
        {
            string[] text = new string[] {
                "This is a (target) test for message without any real sentences",
                "This is a (target) test for message.",
                "This is a (target) test. for message",
                "This is a (target. ) test for message",
                "A prelim sentence. This is a target message.",
                "A prelim sentence. This is a target message. And a final sentence.",
                "Many sentences. Heres another. A prelim sentence. This is a target message.",
                "Many sentences. Heres another.   This is a target message.   And a final sentence. More, more.",
                "target: some stuff. And more stuff.",
                "Let's go team! Hey @target, when you releasing doing 1.0? Please let us know asap",
            };
            string[] expected = new string[] {
                text[0],
                text[1],
                "This is a (target) test.",
                "This is a (target.",
                "This is a target message.",
                "This is a target message.",
                "This is a target message.",
                "This is a target message.",
                "target: some stuff.",
                "Hey @target, when you releasing doing 1.0?"
            };

            string target = "target";

            Assert.AreEqual(text.Length, expected.Length);
            for (int i = 0; i < text.Length; i++)
            {
                string actual = Utils_Accessor.FindSentenceContaining(text[i], target);
                Assert.AreEqual(expected[i], actual, i.ToString());
            }
        }
Пример #4
0
 public void IsValidPathTest()
 {
     Assert.IsFalse(Utils_Accessor.IsValidPath(null));
     Assert.IsFalse(Utils_Accessor.IsValidPath(String.Empty));
     Assert.IsTrue(Utils_Accessor.IsValidPath("c:\\test.txt"));
 }