public void IsMatchTest() { { var rightAnswer = new CorrectAnswer("This is an apple."); rightAnswer.CorrectAnswerHelper = new CorrectAnswerHelperUsingRegex(rightAnswer); string s = null; Assert.False(rightAnswer.IsMatch(s)); Assert.False(rightAnswer.IsMatch("")); Assert.False(rightAnswer.IsMatch(" ")); } { var rightAnswer = new CorrectAnswer("This is an apple."); rightAnswer.CorrectAnswerHelper = new CorrectAnswerHelperUsingNormalizer(rightAnswer); string s = null; Assert.False(rightAnswer.IsMatch(s)); Assert.False(rightAnswer.IsMatch("")); Assert.False(rightAnswer.IsMatch(" ")); } }
public void Test0() { { var rightAnswer = new CorrectAnswer("This is an apple."); rightAnswer.CorrectAnswerHelper = new CorrectAnswerHelperUsingRegex(rightAnswer); Assert.AreEqual("This is an apple.", rightAnswer.Text); Assert.AreEqual(@"This\s+is\s+an\s+apple\s*\.", ((CorrectAnswerHelperUsingRegex)rightAnswer.CorrectAnswerHelper).RegexPattern); Assert.True(rightAnswer.IsMatch("This is an apple.")); Assert.True(rightAnswer.IsMatch(new [] { new MondaiWord("This"), new MondaiWord("is"), new MondaiWord("an"), new MondaiWord("apple"), new MondaiWord("."), })); } { var rightAnswer = new CorrectAnswer("This is an apple."); rightAnswer.CorrectAnswerHelper = new CorrectAnswerHelperUsingNormalizer(rightAnswer); Assert.AreEqual("This is an apple.", rightAnswer.Text); Assert.True(rightAnswer.IsMatch("This is an apple.")); Assert.True(rightAnswer.IsMatch(new [] { new MondaiWord("This"), new MondaiWord("is"), new MondaiWord("an"), new MondaiWord("apple"), new MondaiWord("."), })); } { var rightAnswer = new CorrectAnswer(@"""Aren't you swim?"" ""No, I can't."""); Assert.True(rightAnswer.IsMatch(@"""Aren't you swim ?"" ""No , I can't.""")); } }