コード例 #1
0
        public void TestCommandLineArgsParser(string argString, long expectedValue)
        {
            string[] args = argString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            IParser parser = new CommandLineTextParser(args);

            ICounter testCounter = new MemoryCounter();

            parser.Parse(testCounter);

            List <BigramCountValue> counts = testCounter.BigramCountList();

            Assert.AreEqual(7, counts.Count);   // 8 bigrams added but 7 values since 1 repeats

            var count = from c in counts
                        where c.Bigram == "the quick"
                        select c.Count;

            Assert.AreEqual(1, count.Count());
            Assert.AreEqual(expectedValue, count.First());
        }
コード例 #2
0
        public void TestIsEndOfLine(string word, bool expectedValue)
        {
            CommandLineTextParser parser = new CommandLineTextParser(new string[] { "test" });

            Assert.AreEqual(expectedValue, parser.IsEndOfSentence(word));
        }