public void UnsafeQueryTest()
 {
     method            = GetMethodForTest("UnsafeQuery");
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNotNull(messageCollection);
     Assert.AreEqual(1, messageCollection.Count);
 }
 public void toStringReturningNullTest()
 {
     type = GetTest("ToStringReturningNull");
     foreach (MethodDefinition method in type.Methods)
     {
         messageCollection = methodRule.CheckMethod(method, new MinimalRunner());
     }
     Assert.IsNotNull(messageCollection);
     Assert.AreEqual(1, messageCollection.Count);
 }
 public void equalsChecksForNullArgTest()
 {
     type = GetTest("EqualsChecksForNullArg");
     foreach (MethodDefinition method in type.Methods)
     {
         if (method.Name == "Equals")
         {
             messageCollection = methodRule.CheckMethod(method, new MinimalRunner());
         }
     }
     Assert.IsNull(messageCollection);
 }
 private void CheckMethods(IMethodRule rule, ICollection methods, Runner runner)
 {
     foreach (MethodDefinition method in methods)
     {
         AddExistingMessages(rule.CheckMethod(method, runner));
     }
 }
Example #5
0
 public void callToEqualsWithNullArgTest()
 {
     type = GetTest("CallToEqualsWithNullArg");
     foreach (MethodDefinition method in type.Methods)
     {
         messageCollection = methodRule.CheckMethod(method, new MinimalRunner());
     }
     Assert.IsNotNull(messageCollection);
     Assert.AreEqual(1, messageCollection.Count);
 }
Example #6
0
 public void propertyTest()
 {
     type = GetTest("ClassContainingProperty");
     foreach (MethodDefinition method in type.Methods)
     {
         messageCollection = methodRule.CheckMethod(method, new MinimalRunner());
     }
     Assert.IsNull(messageCollection);
 }
Example #7
0
 MessageCollection CheckMethod(MethodDefinition method)
 {
     return(rule.CheckMethod(method, new MinimalRunner()));
 }
Example #8
0
 public void uncalledPrivateMethodTest()
 {
     type = GetTest("UncalledPrivateMethod");
     foreach (MethodDefinition method in type.Methods)
     {
         if (method.Name == "display")
         {
             messageCollection = methodRule.CheckMethod(method, new MinimalRunner());
         }
     }
     Assert.IsNotNull(messageCollection);
     Assert.AreEqual(1, messageCollection.Count);
 }
Example #9
0
 public void PrintBannerUsingParameterTest()
 {
     method            = GetMethodForTest("PrintBannerUsingParameter");
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
Example #10
0
 public void SwallowErrorsCatchingExceptionsEmptyCatchBlockTest()
 {
     method            = type.Methods.GetMethod("SwallowErrorsCatchingExceptionEmptyCatchBlock", Type.EmptyTypes);
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNotNull(messageCollection);
     Assert.AreEqual(messageCollection.Count, 1);
     CheckMessageType(messageCollection, MessageType.Error);
 }
		private void CheckMethods (IMethodRule rule, ICollection methods, Runner runner) 
		{
			foreach (MethodDefinition method in methods) {
				AddExistingMessages (rule.CheckMethod (method, runner));
			}
		}
 public void MethodWithoutParametersTest()
 {
     method            = GetMethodForTest("MethodWithoutParameters", Type.EmptyTypes);
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }