Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNéstor Salceda <nestor@mono-cvs.ximian.com>2008-02-07 20:47:50 +0300
committerNéstor Salceda <nestor@mono-cvs.ximian.com>2008-02-07 20:47:50 +0300
commit351e05d62744a001bc7522219a437511ea6e6449 (patch)
treed231786e25d6481e4fd7ac30a8aadca75e3ffbb3 /gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs
parentf4c6319b80cc4f5123fc8ae16942ac66f53aca43 (diff)
2008-02-07 Nestor Salceda <nestor.salceda@gmail.com>
* AvoidLargeClassesRule.cs: Avoid positive when a class contains constants or readonly fields. * Test/AvoidLargeClassesTest.cs: Added a test for class storing common constant values. svn path=/trunk/mono-tools/; revision=95169
Diffstat (limited to 'gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs')
-rw-r--r--gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs b/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs
index 540f7e77..606cceb6 100644
--- a/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs
+++ b/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs
@@ -59,6 +59,16 @@ namespace Test.Rules.Smells {
string[] array;
}
+ public class ConstantClass {
+ const int x = 0, x1 = 1, x2 = 2, x3 = 3;
+ static readonly string foo, foo1, foo2, foo3;
+ static readonly DateTime bar, bar1, bar2, bar3;
+ float one, two, three, four;
+ const char c = 'c', c1 = 'b', c2 = 'a', c3 = 'z';
+ const short s = 2, s1 = 4, s2 = 6, s3 = 8;
+ static readonly string[] array;
+ }
+
public class ClassWithPrefixedFieldsWithCamelCasing {
int fooBar;
int fooBaz;
@@ -131,6 +141,16 @@ namespace Test.Rules.Smells {
Assert.IsNull (messageCollection);
}
+
+ [Test]
+ public void ConstantClassTest ()
+ {
+ type = assembly.MainModule.Types["Test.Rules.Smells.ConstantClass"];
+ messageCollection = rule.CheckType (type, new MinimalRunner ());
+ Assert.IsNull (messageCollection);
+ }
+
+
[Test]
public void ClassWithPrefixedFieldsWithCamelCasingTest ()
{