public void Test_TimeoutRegexCheckOnDecentList(string email, bool expectedResult) { var allBlackList = _allData .Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries) .Where(brs => !string.IsNullOrWhiteSpace(brs)) .Select(brs => new Regex(brs.Trim(), RegexOptions.IgnoreCase, TimeSpan.FromSeconds(5))) .ToArray(); var checker = new BlacklistChecker(allBlackList); var result = checker.IsBlacklistedWithTimeout(email); Assert.AreEqual(expectedResult, result); }
public void BlackListCheckerRemovesRequiredWords() { Conversation conversation = new Conversation("TestConversation", new List <Message>() { new Message(DateTimeOffset.Now, "Bob", "I like pie because pie is good") }); BlacklistChecker checker = new BlacklistChecker(new List <string> { "pie", "good" }); var expectedResult = "I like *redacted* because *redacted* is *redacted*"; var checkedConversation = checker.CheckConversation(conversation); Assert.That(checkedConversation.Messages[0].Content, Is.EqualTo(expectedResult)); }