public void MethodsWithMoreThanThreeParamsBreakRule(string methodName, int expectedProblemCount) { var rule = new LongParamListRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(Foo), methodName)); Assert.AreEqual(expectedProblemCount, rule.Problems.Count); }
public void MethodsWithMoreThanThreeBranchesBreakRule(string methodName, int expectedProblemCount) { var rule = new MethodComplexityRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(ClassD), methodName)); Assert.AreEqual(expectedProblemCount, rule.Problems.Count); }
public void MethodsWithMoreThanTenStatementsBreakRule(string methodName, int expectedProblemCount) { var rule = new LongMethodRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(Bar), methodName)); Assert.AreEqual(expectedProblemCount, rule.Problems.Count); }
public void FactoryOrBuilderMethodsDontCount(string methodName, int expectedProblemCount) { var rule = new MethodCallRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(ClassF), methodName)); Assert.That(rule.Problems.Count, Is.EqualTo(expectedProblemCount)); }
public void CannotInvokeConcreteMethods(string methodName, int expectedProblemCount) { var rule = new MethodCallRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(ClassF), methodName)); Assert.That(rule.Problems.Count, Is.EqualTo(expectedProblemCount)); }
public void MethodsCantUseNewOnProjectClasses(string methodName, int expectedProblemCount) { var rule = new ObjectCreationRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(ClassE), methodName)); Assert.That(rule.Problems.Count, Is.EqualTo(expectedProblemCount)); }
public void MethodsThatMakeMultipleCallsToCollaboratorsHaveFeatureEnvy(string methodName, int expectedProblemCount) { var rule = new FeatureEnvyRule(); rule.Check(AssemblyReader.GetMethodByName(typeof(Client), methodName)); Assert.AreEqual(expectedProblemCount, rule.Problems.Count); }
public void MethodsWithBooleanParametersBreakRule(string methodName, int expectedProblemCount) { var rule = new BooleanParameterRule(); var method = AssemblyReader.GetMethodByName(typeof(ClassC), methodName); var param = method.Parameters[0]; rule.Check(param); Assert.AreEqual(expectedProblemCount, rule.Problems.Count); }