public void RuleShouldReturnValidForStatementsThatDoNotMatchThePatternButArePublicStatic() { MemberNameMatchesPatternRule rule = new MemberNameMatchesPatternRule(new Regex("^_[a-z]+"), true); IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PublicModifierToken>()); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <StaticToken>()); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <IdentifierToken>("String")); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <IdentifierToken>("Test")); input.Add(TokenCreator.Create <SemiColonToken>()); MemberStatement member = new MemberStatement(input, null); Assert.IsTrue(rule.IsValidFor(member)); }
public void RuleShouldReturnInvalidForStatementsThatDoNotMatchThePattern() { MemberNameMatchesPatternRule rule = new MemberNameMatchesPatternRule(new Regex("^_[a-z]+"), false); Assert.IsFalse(rule.IsValidFor(StatementCreator.CreateMemberStatement("ATest"))); }
public void RuleShouldValidateStatements() { MemberNameMatchesPatternRule rule = new MemberNameMatchesPatternRule(new Regex(""), false); Assert.IsTrue(rule.Validates(StatementCreator.CreateMemberStatement("member"))); }