public void StartsWithTest() { var mondaiWords0 = new [] { new MondaiWord("This"), new MondaiWord("is"), }; var mondaiWords1 = new [] { new MondaiWord("this"), new MondaiWord("is"), }; var mondaiWords2 = new [] { new MondaiWord("aaa"), new MondaiWord("This"), new MondaiWord("is"), }; var mondaiWords3 = new [] { new MondaiWord("This is"), new MondaiWord("an apple."), }; { var rightAnswer = new CorrectAnswer("This is an apple."); rightAnswer.CorrectAnswerHelper = new CorrectAnswerHelperUsingRegex(rightAnswer); { var s = MondaiWord.SimplyJoin(mondaiWords0); Assert.AreEqual("This is", s); var p = "^" + MondaiWord.GetRegexPattern(s); Assert.AreEqual(@"^This\s+is", p); StringAssert.IsMatch(p, rightAnswer.Text); } Assert.Throws<ArgumentNullException>(() => { rightAnswer.StartsWith(null); }); Assert.True(rightAnswer.StartsWith(new MondaiWord[0])); Assert.True(rightAnswer.StartsWith(mondaiWords0)); Assert.False(rightAnswer.StartsWith(mondaiWords1)); Assert.False(rightAnswer.StartsWith(mondaiWords2)); Assert.True(rightAnswer.StartsWith(mondaiWords3)); } { var rightAnswer = new CorrectAnswer("This is an apple."); rightAnswer.CorrectAnswerHelper = new CorrectAnswerHelperUsingNormalizer(rightAnswer); Assert.Throws<ArgumentNullException>(() => { rightAnswer.StartsWith(null); }); Assert.True(rightAnswer.StartsWith(new MondaiWord[0])); Assert.True(rightAnswer.StartsWith(mondaiWords0)); Assert.False(rightAnswer.StartsWith(mondaiWords1)); Assert.False(rightAnswer.StartsWith(mondaiWords2)); Assert.True(rightAnswer.StartsWith(mondaiWords3)); } }