public void IsWrongRule_WrongPattern_True() { const string pattern = @"^(?<e>[\s\S]*)$"; const string text = " a1vd bu "; var lexicalRule = MockRepository.GenerateMock<ILexicalRule>(); lexicalRule.Expect(r => r.Pattern).Return(pattern); var compiledLexicalRule = new CompiledLexicalRule(lexicalRule); Assert.That(compiledLexicalRule.IsMatch(text), Is.True); Assert.That(compiledLexicalRule.IsWrongRule(text), Is.True); lexicalRule.VerifyAllExpectations(); }
public void IsWrongRule_IdentifierPattern_False() { const string text = " a1vd bu "; var lexicalRule = MockRepository.GenerateMock<ILexicalRule>(); lexicalRule.Expect(r => r.Pattern).Return(IdentifierExpression); var compiledLexicalRule = new CompiledLexicalRule(lexicalRule); Assert.That(compiledLexicalRule.IsMatch(text), Is.True); Assert.That(compiledLexicalRule.IsWrongRule(text), Is.False); lexicalRule.VerifyAllExpectations(); }