예제 #1
0
        public void TestCreateProcessor()
        {
            var kp = new KeywordProcessor();

            kp.AddKeyword("Big Apple", cleanName: "New York");

            Assert.That(kp.CaseSensitive, Is.False);
            Assert.That(kp.Contains("Big"), Is.False);
            Assert.That(kp.Contains("Big Apple"), Is.True);
        }
예제 #2
0
        public void TestRemoveKeyword()
        {
            var kp = new KeywordProcessor();

            kp.AddKeyword(".net core");
            kp.AddKeyword("C# 8.0");
            kp.AddKeywords(new [] { "C# 7.0", "C# 8.0" });

            var keywords = kp.ExtractKeywords("I am learning .net core and c# 8.0");
            var expected = new List <string> {
                ".net core", "C# 8.0"
            };

            CollectionAssert.AreEqual(expected, keywords);

            Assert.That(kp.Contains("C# 8.0"), Is.True);
            kp.RemoveKeyword("C# 8.0");
            Assert.That(kp.Contains("C# 8.0"), Is.False);
            keywords = kp.ExtractKeywords("I am learning .net core and c# 8.0");
            expected = new List <string> {
                ".net core"
            };
            CollectionAssert.AreEqual(expected, keywords);
        }