Author: spouliot
Date: 2007-12-26 13:05:20 -0500 (Wed, 26 Dec 2007)
New Revision: 91901

Added:
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectCasingTest.cs
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectPrefixTest.cs
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectSuffixTest.cs
   
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UsePreferredTermsTest.cs
Removed:
   
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/AttributeEndsWithAttributeSuffixTest.cs
Modified:
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/ChangeLog
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/Test.Rules.Naming.mdp
Log:
2007-12-26  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * AttributeEndsWithAttributeSuffixTest.cs: Deleted. The new
        UseCorrectSuffixTest is a superset of the rule/tests.
        * Test.Rules.Naming.mdp: Update MonoDevelop project file.
        * UseCorrectPrefixTest.cs: New. Test cases from Daniel Abramov.
        * UseCorrectCasingTest.cs: New. Test cases from Daniel Abramov.
        * UseCorrectSuffixTest.cs: New. Test cases from Daniel Abramov.
        * UsePreferredTermsTest.cs: New. Test cases from Daniel Abramov.



Deleted: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/AttributeEndsWithAttributeSuffixTest.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/AttributeEndsWithAttributeSuffixTest.cs
       2007-12-26 17:37:09 UTC (rev 91900)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/AttributeEndsWithAttributeSuffixTest.cs
       2007-12-26 18:05:20 UTC (rev 91901)
@@ -1,152 +0,0 @@
-//
-// Unit Test for AttributeEndsWithAttributeSuffix Rule
-//
-// Authors:
-//     Néstor Salceda <[EMAIL PROTECTED]>
-//
-//  (C) 2007 Néstor Salceda
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Reflection;
-
-using Gendarme.Framework;
-using Gendarme.Rules.Naming;
-using Mono.Cecil;
-using NUnit.Framework;
-
-namespace Test.Rules.Naming {
-
-       public class CorrectAttribute : Attribute {
-       }
-
-       public class Incorrect : Attribute {
-       }
-
-       public class OtherAttribute : CorrectAttribute {
-       }
-       
-       public class Other : CorrectAttribute {
-       }
-       
-       public class CorrectContextStaticAttribute : ContextStaticAttribute {
-       }
-       
-       public class OtherClass {
-       }
-       
-       public class YetAnotherClass : System.Exception {
-       }
-       
-       [TestFixture]
-       public class AttributeEndsWithAttributeSuffixTest {
-               private ITypeRule rule;
-               private AssemblyDefinition assembly;
-               private TypeDefinition type;
-               private MessageCollection messageCollection;
-       
-               [TestFixtureSetUp]
-               public void FixtureSetUp ()
-               {
-                       string unit = Assembly.GetExecutingAssembly ().Location;
-                       assembly = AssemblyFactory.GetAssembly (unit);
-                       rule = new AttributeEndsWithAttributeSuffixRule ();
-                       messageCollection = null;
-               }
-               
-               private void CheckMessageType (MessageCollection 
messageCollection, MessageType messageType) 
-               {
-                       IEnumerator enumerator = 
messageCollection.GetEnumerator ();
-                       if (enumerator.MoveNext ()) {
-                               Message message = (Message) enumerator.Current;
-                               Assert.AreEqual (message.Type, messageType);
-                       }
-               }
-               
-               [Test]
-               public void TestOneLevelInheritanceIncorrectName () 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.Incorrect"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNotNull (messageCollection);
-                       Assert.AreEqual (messageCollection.Count, 1);
-                       CheckMessageType (messageCollection, MessageType.Error);
-               }
-               
-               [Test]
-               public void TestOneLevelInheritanceCorrectName () 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectAttribute"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNull (messageCollection);
-               }
-               
-               [Test]
-               public void TestVariousLevelInheritanceCorrectName () 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.OtherAttribute"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNull (messageCollection);
-               }
-               
-               [Test]
-               public void TestVariousLevelInheritanceIncorrectName () 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.Other"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNotNull (messageCollection);
-                       Assert.AreEqual (messageCollection.Count, 1);
-                       CheckMessageType (messageCollection, MessageType.Error);
-               }
-               
-               [Test]
-               public void TestVariousLevelInheritanceExternalTypeUndetermined 
() 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectContextStaticAttribute"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNull (messageCollection);
-                       //The System.ContextStaticAttribute class inherits from 
System.Attribute.
-                       //But we can retrieve that info from a TypeReference, 
because now 
-                       //Gendarme doesn't support loading assemblies.
-               }
-               
-               [Test]
-               public void TestOneLevelInheritanceExternalTypeNoApplyed () 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.OtherClass"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNull (messageCollection);
-               }
-               
-               [Test]
-               public void TestVariousLevelInheritanceExternalTypeNoApplyed () 
-               {
-                       type = assembly.MainModule.Types 
["Test.Rules.Naming.YetAnotherClass"];
-                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
-                       Assert.IsNull (messageCollection);
-                       //The System.Random class doesn't inherit from 
System.Attribute.
-                       //But we can retrieve that info from a TypeReference, 
because now 
-                       //Gendarme doesn't support loading assemblies.
-               }
-       }
-}
\ No newline at end of file

Modified: trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/ChangeLog
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/ChangeLog     
2007-12-26 17:37:09 UTC (rev 91900)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/ChangeLog     
2007-12-26 18:05:20 UTC (rev 91901)
@@ -1,3 +1,13 @@
+2007-12-26  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * AttributeEndsWithAttributeSuffixTest.cs: Deleted. The new
+       UseCorrectSuffixTest is a superset of the rule/tests.
+       * Test.Rules.Naming.mdp: Update MonoDevelop project file.
+       * UseCorrectPrefixTest.cs: New. Test cases from Daniel Abramov.
+       * UseCorrectCasingTest.cs: New. Test cases from Daniel Abramov.
+       * UseCorrectSuffixTest.cs: New. Test cases from Daniel Abramov.
+       * UsePreferredTermsTest.cs: New. Test cases from Daniel Abramov.
+
 2007-10-08  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * DetectNonAlphaNumericsInTypeNamesTest.cs: Add test cases for 

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/Test.Rules.Naming.mdp
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/Test.Rules.Naming.mdp 
2007-12-26 17:37:09 UTC (rev 91900)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/Test.Rules.Naming.mdp 
2007-12-26 18:05:20 UTC (rev 91901)
@@ -14,11 +14,14 @@
     </Configuration>
   </Configurations>
   <Contents>
-    <File name="./AttributeEndsWithAttributeSuffixTest.cs" subtype="Code" 
buildaction="Compile" />
-    <File name="./EnumNotEndsWithEnumOrFlagsSuffixTest.cs" subtype="Code" 
buildaction="Compile" />
-    <File name="./UsePluralNameInEnumFlagsTest.cs" subtype="Code" 
buildaction="Compile" />
-    <File name="./UseSingularNameInEnumsUnlessAreFlagsTest.cs" subtype="Code" 
buildaction="Compile" />
-    <File name="./DetectNonAlphaNumericsInTypeNamesTest.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="EnumNotEndsWithEnumOrFlagsSuffixTest.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="UsePluralNameInEnumFlagsTest.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="UseSingularNameInEnumsUnlessAreFlagsTest.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="DetectNonAlphaNumericsInTypeNamesTest.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="UseCorrectCasingTest.cs" subtype="Code" buildaction="Compile" 
/>
+    <File name="UseCorrectPrefixTest.cs" subtype="Code" buildaction="Compile" 
/>
+    <File name="UseCorrectSuffixTest.cs" subtype="Code" buildaction="Compile" 
/>
+    <File name="UsePreferredTermsTest.cs" subtype="Code" buildaction="Compile" 
/>
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="framework" />

Added: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectCasingTest.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectCasingTest.cs   
    2007-12-26 17:37:09 UTC (rev 91900)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectCasingTest.cs   
    2007-12-26 18:05:20 UTC (rev 91901)
@@ -0,0 +1,290 @@
+//
+// Unit Test for UseCorrectCasingRule
+//
+// Authors:
+//      Abramov Daniel <[EMAIL PROTECTED]>
+//
+//  (C) 2007 Abramov Daniel
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+using Gendarme.Framework;
+using Gendarme.Rules.Naming;
+using Mono.Cecil;
+using NUnit.Framework;
+
+namespace Test.Rules.Naming {
+
+       public class CorrectCasing {
+       }
+
+       public class incorrectCasing {
+       }
+
+       public class CasingMethods {
+               public void CorrectCasing (int foo, string bar) { }
+               public void incorrectCasing (int foo, string bar) { }
+               public void CorrectCasingWithTwoIncorrectParameters (int Bar, 
string Foo) { }
+               public void incorrectCasingWithTwoIncorrectParameters (int Bar, 
string Foo) { }
+       }
+
+       public class MoreComplexCasing {
+               static MoreComplexCasing () { } // .cctor, should be ignored
+               public MoreComplexCasing () { } // .ctor, should be ignored
+               public int GoodProperty { get { return 0; } set { } }
+               public int badProperty { get { return 0; } set { } }
+               public int get_AccessorLike () { return 0; } // should be 
catched
+               public void set_AccessorLike (int value) { } // should be 
catched
+               public event EventHandler GoodEvent
+               {
+                       add { throw new NotImplementedException (); }
+                       remove { throw new NotImplementedException (); }
+               }
+               public event EventHandler badEvent
+               {
+                       add { throw new NotImplementedException (); }
+                       remove { throw new NotImplementedException (); }
+               }
+               public static int operator + (MoreComplexCasing a, int b) { 
return 0; } // ignore!
+       }
+
+       [TestFixture]
+       public class UseCorrectCasingTest {
+               public class AnonymousMethod {
+                       private void MethodWithAnonymousMethod ()
+                       {
+                               string [] values = new string [] { "one", 
"two", "three" };
+                               if (Array.Exists (values, delegate (string 
myString) { return myString.Length == 3; }))
+                                       Console.WriteLine ("Exists strings with 
length == 3");
+                       }
+               }
+
+               private UseCorrectCasingRule rule;
+               private AssemblyDefinition assembly;
+               private TypeDefinition type;
+               private MessageCollection messageCollection;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       string unit = Assembly.GetExecutingAssembly ().Location;
+                       assembly = AssemblyFactory.GetAssembly (unit);
+                       rule = new UseCorrectCasingRule ();
+                       messageCollection = null;
+               }
+
+               private void CheckMessageType (MessageCollection 
messageCollection, MessageType messageType)
+               {
+                       IEnumerator enumerator = 
messageCollection.GetEnumerator ();
+                       if (enumerator.MoveNext ()) {
+                               Message message = (Message) enumerator.Current;
+                               Assert.AreEqual (messageType, message.Type);
+                       }
+               }
+
+               private MethodDefinition GetMethod (string name)
+               {
+                       foreach (MethodDefinition method in type.Methods) {
+                               if (method.Name == name)
+                                       return method;
+                       }
+                       return null;
+               }
+
+               [Test]
+               public void TestCorrectCasedClass ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectCasing"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestIncorrectCasedClass ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.incorrectCasing"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestCorrectCasedMethod ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CasingMethods"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("CorrectCasing"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestIncorrectCasedMethod ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CasingMethods"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("incorrectCasing"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestCorrectCasedMethodWithIncorrectCasedParameters 
()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CasingMethods"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("CorrectCasingWithTwoIncorrectParameters"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (2, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void 
TestIncorrectCasedMethodWithIncorrectCasedParameters ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CasingMethods"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("incorrectCasingWithTwoIncorrectParameters"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (3, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestIgnoringCctor ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       foreach (MethodDefinition method in type.Constructors)
+                               if (method.Name == ".cctor")
+                                       messageCollection = rule.CheckMethod 
(method, new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestIgnoringCtor ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       foreach (MethodDefinition method in type.Constructors) {
+                               Assert.IsNull (rule.CheckMethod (method, new 
MinimalRunner ()), method.Name);
+                       }
+               }
+
+               [Test]
+               public void TestGoodProperty ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("get_GoodProperty"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+                       messageCollection = rule.CheckMethod (GetMethod 
("set_GoodProperty"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestBadProperty ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("get_badProperty"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+                       messageCollection = rule.CheckMethod (GetMethod 
("set_badProperty"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestGoodEventHandler ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("add_GoodEvent"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+                       messageCollection = rule.CheckMethod (GetMethod 
("remove_GoodEvent"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestBadEventHandler ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("add_badEvent"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+                       messageCollection = rule.CheckMethod (GetMethod 
("remove_badEvent"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestPropertyLikeMethods ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("get_AccessorLike"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+                       messageCollection = rule.CheckMethod (GetMethod 
("set_AccessorLike"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+
+               [Test]
+               public void TestIgnoringOperator ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.MoreComplexCasing"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("op_Addition"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestAnonymousMethod ()
+               {
+                       // compiler generated code is compiler dependant, check 
for [g]mcs (inner type)
+                       type = GetTest 
("AnonymousMethod/<>c__CompilerGenerated0");
+                       // otherwise try for csc (inside same class)
+                       if (type == null)
+                               type = GetTest ("AnonymousMethod");
+
+                       Assert.IsNotNull (type, "type not found");
+                       foreach (MethodDefinition method in type.Methods) {
+                               switch (method.Name) {
+                               case "MethodWithAnonymousMethod":
+                                       // this isn't part of the test (but 
included with CSC)
+                                       break;
+                               default:
+                                       Assert.IsNull (rule.CheckMethod 
(method, new MinimalRunner ()));
+                                       break;
+                               }
+                       }
+               }
+
+               private TypeDefinition GetTest (string name)
+               {
+                       string fullname = 
"Test.Rules.Naming.UseCorrectCasingTest/" + name;
+                       return assembly.MainModule.Types [fullname];
+               }
+       }
+}

Added: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectPrefixTest.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectPrefixTest.cs   
    2007-12-26 17:37:09 UTC (rev 91900)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectPrefixTest.cs   
    2007-12-26 18:05:20 UTC (rev 91901)
@@ -0,0 +1,160 @@
+//
+// Unit Test for UseCorrectPrefixRule
+//
+// Authors:
+//      Abramov Daniel <[EMAIL PROTECTED]>
+//
+//  (C) 2007 Abramov Daniel
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+using Gendarme.Framework;
+using Gendarme.Rules.Naming;
+using Mono.Cecil;
+using NUnit.Framework;
+
+namespace Test.Rules.Naming {
+
+       public class CorrectClass {
+       }
+
+       public class AnotherCorrectClass {
+       }
+
+       public class CIncorrectClass {
+       }
+
+       public interface ICorrectInterface {
+       }
+
+       public interface IncorrectInterface {
+       }
+
+       public interface AnotherIncorrectInterface {
+       }
+
+       public class CLSAbbreviation { // ok
+       }
+
+       public interface ICLSAbbreviation { // ok too
+       }
+
+       [TestFixture]
+       public class UseCorrectPrefixTest {
+
+               private ITypeRule rule;
+               private AssemblyDefinition assembly;
+               private TypeDefinition type;
+               private MessageCollection messageCollection;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       string unit = Assembly.GetExecutingAssembly ().Location;
+                       assembly = AssemblyFactory.GetAssembly (unit);
+                       rule = new UseCorrectPrefixRule ();
+                       messageCollection = null;
+               }
+
+               private void CheckMessageType (MessageCollection 
messageCollection, MessageType messageType)
+               {
+                       IEnumerator enumerator = 
messageCollection.GetEnumerator ();
+                       if (enumerator.MoveNext ()) {
+                               Message message = (Message) enumerator.Current;
+                               Assert.AreEqual (messageType, message.Type);
+                       }
+               }
+
+               [Test]
+               public void TestCorrectClass ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectClass"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestAnotherCorrectClass ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.AnotherCorrectClass"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestIncorrectClass ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CIncorrectClass"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestCorrectInterface ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.ICorrectInterface"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestIncorrectInterface ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.IncorrectInterface"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestAnotherIncorrectInterface ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.AnotherIncorrectInterface"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+
+               [Test]
+               public void TestClassAbbreviation ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CLSAbbreviation"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestInterfaceAbbreviation ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.ICLSAbbreviation"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+       }
+}

Added: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectSuffixTest.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectSuffixTest.cs   
    2007-12-26 17:37:09 UTC (rev 91900)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectSuffixTest.cs   
    2007-12-26 18:05:20 UTC (rev 91901)
@@ -0,0 +1,367 @@
+//
+// Unit Test for UseCorrectSuffix Rule
+//
+// Authors:
+//     Néstor Salceda <[EMAIL PROTECTED]>
+//      Abramov Daniel <[EMAIL PROTECTED]>
+//
+//  (C) 2007 Néstor Salceda
+//  (C) 2007 Abramov Daniel
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+using Gendarme.Framework;
+using Gendarme.Rules.Naming;
+using Mono.Cecil;
+using NUnit.Framework;
+
+namespace Test.Rules.Naming {
+
+       public class CorrectAttribute : Attribute {
+       }
+
+       public class IncorrectAttr : Attribute {
+       }
+
+       public class OtherAttribute : CorrectAttribute {
+       }
+       
+       public class OtherAttr : CorrectAttribute {
+       }
+       
+       public class CorrectContextStaticAttribute : ContextStaticAttribute {
+       }
+       
+       public class OtherClass {
+       }
+       
+       public class YetAnotherClass : System.Random {
+       }
+       
+       public class InterfaceImplementer : System.Collections.ICollection {
+               
+               public int Count {
+                       get {
+                               throw new NotImplementedException();
+                       }
+               }
+
+               public bool IsSynchronized {
+                       get {
+                               throw new NotImplementedException();
+                       }
+               }
+
+               public object SyncRoot {
+                       get {
+                               throw new NotImplementedException();
+                       }
+               }
+
+               
+               
+               public IEnumerator GetEnumerator ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void CopyTo (Array array, int index)
+               {
+                       throw new NotImplementedException();
+               }
+
+       }
+       
+       public class CorrectICollectionCollection : InterfaceImplementer {
+       }
+       
+       public class IncorrectICollectionCol : InterfaceImplementer {
+       }
+       
+       public class MultipleInterfaceImplementer : IEnumerable, 
System.Security.IPermission {          
+               public IEnumerator GetEnumerator ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void FromXml (System.Security.SecurityElement e)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.SecurityElement ToXml ()
+               {
+               throw new NotImplementedException();
+               }
+
+               public System.Security.IPermission Copy ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void Demand ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.IPermission Intersect 
(System.Security.IPermission target)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public bool IsSubsetOf (System.Security.IPermission target)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.IPermission Union 
(System.Security.IPermission target)
+               {
+                       throw new NotImplementedException();
+               }
+       }
+       
+       public class CorrectMultipleInterfaceImplementerPermission : 
MultipleInterfaceImplementer {
+       }
+
+       public class CorrectMultipleInterfaceImplementerCollection : 
MultipleInterfaceImplementer {
+       }
+       
+       public class IncorrectMultipleInterfaceImplementer : 
MultipleInterfaceImplementer {
+       }
+       
+       public class DerivingClassImplementingInterfaces : System.EventArgs, 
IEnumerable, System.Security.IPermission {          
+               
+               public IEnumerator GetEnumerator ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void FromXml (System.Security.SecurityElement e)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.SecurityElement ToXml ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.IPermission Copy ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void Demand ()
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.IPermission Intersect 
(System.Security.IPermission target)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public bool IsSubsetOf (System.Security.IPermission target)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public System.Security.IPermission Union 
(System.Security.IPermission target)
+               {
+                       throw new NotImplementedException();
+               }
+       }
+       
+       public class CorrectDerivingClassImplementingInterfacesEventArgs : 
DerivingClassImplementingInterfaces {
+       }
+       
+       public class IncorrectDerivingClassImplementingInterfacesCollection : 
DerivingClassImplementingInterfaces { 
+       }
+       
+       public class IncorrectDerivingClassImplementingInterfaces : 
DerivingClassImplementingInterfaces { 
+       }       
+       
+       [TestFixture]
+       public class UseCorrectSuffixTest {
+               private ITypeRule rule;
+               private AssemblyDefinition assembly;
+               private TypeDefinition type;
+               private MessageCollection messageCollection;
+       
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       string unit = Assembly.GetExecutingAssembly ().Location;
+                       assembly = AssemblyFactory.GetAssembly (unit);
+                       rule = new UseCorrectSuffixRule ();
+                       messageCollection = null;
+               }
+               
+               private void CheckMessageType (MessageCollection 
messageCollection, MessageType messageType) 
+               {
+                       IEnumerator enumerator = 
messageCollection.GetEnumerator ();
+                       if (enumerator.MoveNext ()) {
+                               Message message = (Message) enumerator.Current;
+                               Assert.AreEqual (messageType, message.Type);
+                       }
+               }
+               
+               [Test]
+               public void TestOneLevelInheritanceIncorrectName () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.IncorrectAttr"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+               
+               [Test]
+               public void TestOneLevelInheritanceCorrectName () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectAttribute"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+               
+               [Test]
+               public void TestVariousLevelInheritanceCorrectName () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.OtherAttribute"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+               
+               [Test]
+               public void TestVariousLevelInheritanceIncorrectName () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.OtherAttr"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+               
+               [Test]
+               public void TestVariousLevelInheritanceExternalTypeUndetermined 
() 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectContextStaticAttribute"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+                       //The System.ContextStaticAttribute class inherits from 
System.Attribute.
+                       //But we can retrieve that info from a TypeReference, 
because now 
+                       //Gendarme doesn't support loading assemblies.
+               }
+               
+               [Test]
+               public void TestOneLevelInheritanceExternalTypeNoApplyed () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.OtherClass"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+               
+               [Test]
+               public void TestVariousLevelInheritanceExternalTypeNoApplyed () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.YetAnotherClass"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+                       // The System.Random class doesn't inherit from any 
defined classes.
+                       // But we can retrieve that info from a TypeReference, 
because now 
+                       // Gendarme doesn't support loading assemblies.
+               }
+               
+               [Test]
+               public void TestInterfaceImplementerCorrectName ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectICollectionCollection"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+
+               [Test]
+               public void TestInterfaceImplementerIncorrectName () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.IncorrectICollectionCol"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }                              
+               
+               [Test]
+               public void TestMultipleInterfaceImplementerCorrectName ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectMultipleInterfaceImplementerPermission"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }     
+
+               [Test]
+               public void TestMultipleInterfaceImplementerAnotherCorrectName 
()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectMultipleInterfaceImplementerCollection"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }                                    
+               
+                       [Test]
+               public void TestMultipleInterfaceImplementerIncorrectName () 
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.IncorrectMultipleInterfaceImplementer"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }                              
+               
+               [Test]
+               public void TestDerivingClassImplementingInterfacesCorrectName 
()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.CorrectDerivingClassImplementingInterfacesEventArgs"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }      
+               
+               [Test]
+               public void 
TestDerivingClassImplementingInterfacesIncorrectName ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.IncorrectDerivingClassImplementingInterfaces"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }      
+               
+               [Test]
+               public void 
TestDerivingClassImplementingInterfacesAnotherIncorrectName ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.IncorrectDerivingClassImplementingInterfacesCollection"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }      
+       }
+}

Added: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UsePreferredTermsTest.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UsePreferredTermsTest.cs  
    2007-12-26 17:37:09 UTC (rev 91900)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/Test/UsePreferredTermsTest.cs  
    2007-12-26 18:05:20 UTC (rev 91901)
@@ -0,0 +1,143 @@
+//
+// Unit Test for UsePreferredTermsRule
+//
+// Authors:
+//      Abramov Daniel <[EMAIL PROTECTED]>
+//
+//  (C) 2007 Abramov Daniel
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+using Gendarme.Framework;
+using Gendarme.Rules.Naming;
+using Mono.Cecil;
+using NUnit.Framework;
+
+namespace Test.Rules.Naming {
+       
+       public class SomeComPlusStuff { // one obsolete term ('ComPlus')
+       }
+       
+       public class SomeComPlusAndIndicesStuff { // two obsolete terms 
('ComPlus' and 'Indices')
+       }
+       
+       public class TermsMethodsAndProperties {
+
+               public void SignOn () { } // incorrect
+               public void SignIn () { } // correct
+               
+               public bool Writeable { get { return true; } } // incorrect
+               public bool Writable { get { return true; } } // correct
+       }
+       
+       [TestFixture]
+       public class UsePreferredTermsTest {
+               private UsePreferredTermsRule rule;
+               private AssemblyDefinition assembly;
+               private TypeDefinition type;
+               private MessageCollection messageCollection;
+       
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       string unit = Assembly.GetExecutingAssembly ().Location;
+                       assembly = AssemblyFactory.GetAssembly (unit);
+                       rule = new UsePreferredTermsRule ();
+                       messageCollection = null;
+               }
+               
+               private void CheckMessageType (MessageCollection 
messageCollection, MessageType messageType) 
+               {
+                       IEnumerator enumerator = 
messageCollection.GetEnumerator ();
+                       if (enumerator.MoveNext ()) {
+                               Message message = (Message) enumerator.Current;
+                               Assert.AreEqual (messageType, message.Type);
+                       }
+               }
+               
+               private MethodDefinition GetPropertyGetter (string name)
+               {
+                       string get_name = "get_" + name;
+                       foreach (MethodDefinition method in type.Methods) {
+                               if (method.Name == get_name)
+                                       return method;
+                       }
+                       return null;
+               }
+                               
+               private MethodDefinition GetMethod (string name)
+               {
+                       foreach (MethodDefinition method in type.Methods) {
+                               if (method.Name == name)
+                                       return method;
+                       }
+                       return null;
+               }
+               
+               [Test]
+               public void TestOneObsoleteTerm ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.SomeComPlusStuff"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+               
+               [Test]
+               public void TestTwoObsoleteTerms ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.SomeComPlusAndIndicesStuff"];
+                       messageCollection = rule.CheckType (type, new 
MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (2, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }
+               
+               [Test]
+               public void TestCorrectMethodsAndProperties ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.TermsMethodsAndProperties"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("SignIn"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+                       messageCollection = rule.CheckMethod (GetPropertyGetter 
("Writable"), new MinimalRunner ());
+                       Assert.IsNull (messageCollection);
+               }
+               
+               [Test]
+               public void TestIncorrectMethodsAndProperties ()
+               {
+                       type = assembly.MainModule.Types 
["Test.Rules.Naming.TermsMethodsAndProperties"];
+                       messageCollection = rule.CheckMethod (GetMethod 
("SignOn"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+                       messageCollection = rule.CheckMethod (GetPropertyGetter 
("Writeable"), new MinimalRunner ());
+                       Assert.IsNotNull (messageCollection);
+                       Assert.AreEqual (1, messageCollection.Count);
+                       CheckMessageType (messageCollection, MessageType.Error);
+               }               
+       }
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to