コード例 #1
0
        public void TestAnalyze()
        {
            FakeProgressReporter progressReporter = new FakeProgressReporter();
            var analyzer = new TypoAnalyzer(new FakeFileSystem(), new FakeCorrectWords());
            TypoAnalyzerResult result = analyzer.Analyze(@"c:\dev", "*.cs", progressReporter);

            KeywordOccurrences[] keywords = result.Keywords.ToArray();
            Assert.AreEqual("cruel", keywords[0].Keyword);
            Assert.AreEqual("hello", keywords[1].Keyword);
            Assert.AreEqual("world", keywords[2].Keyword);
            Assert.IsTrue(Enumerable.SequenceEqual(new string[] { "b.cs" }, keywords[0].Occurrences));
        }
コード例 #2
0
 public void TestConstructorWithNullCorrectWords()
 {
     try
     {
         var analyzer = new TypoAnalyzer(new FakeFileSystem(), null);
     }
     catch (ArgumentNullException ex)
     {
         Assert.AreEqual("correctWords", ex.ParamName);
         return;
     }
     Assert.Fail("Expected ArgumentNullException is not thrown.");
 }