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-12-23 00:09:43 +0300
committerNéstor Salceda <nestor@mono-cvs.ximian.com>2008-12-23 00:09:43 +0300
commitf53522831ba68759794d4fbcb980ae92208a4f25 (patch)
treea04e4684284bc2debcee63e3c5e7ce5bb90dd3fb /gendarme/rules/Gendarme.Rules.Smells/Test
parentea84e0834ae3dc463426d5ff64c1fc6e4cd11154 (diff)
2008-12-22 Néstor Salceda <nestor.salceda@gmail.com>
* AvoidSwitchStatementsTest.cs: Added a test for table-driven comparisons, by example with strings. svn path=/trunk/mono-tools/; revision=122010
Diffstat (limited to 'gendarme/rules/Gendarme.Rules.Smells/Test')
-rw-r--r--gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSwitchStatementsTest.cs17
-rw-r--r--gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog5
2 files changed, 22 insertions, 0 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSwitchStatementsTest.cs b/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSwitchStatementsTest.cs
index e8660ac5..2ce507e0 100644
--- a/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSwitchStatementsTest.cs
+++ b/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSwitchStatementsTest.cs
@@ -94,5 +94,22 @@ namespace Test.Rules.Smells {
{
AssertRuleDoesNotApply (Type.GetType ("Test.Rules.Smells.AvoidSwitchStatementsTest+<MethodWithoutSwitchAndGenerator>c__Iterator0"), "MoveNext");
}
+
+ void SwitchWithStrings (string sample)
+ {
+ switch (sample) {
+ case "Foo":
+ case "Bar":
+ return;
+ case "Baz":
+ throw new ArgumentException ("sample");
+ }
+ }
+
+ [Test]
+ public void FailOnSwitchWithStringsTest ()
+ {
+ AssertRuleFailure<AvoidSwitchStatementsTest> ("SwitchWithStrings", 1);
+ }
}
}
diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog b/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog
index 8d8c89e6..7b90e337 100644
--- a/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog
+++ b/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog
@@ -1,5 +1,10 @@
2008-12-22 Néstor Salceda <nestor.salceda@gmail.com>
+ * AvoidSwitchStatementsTest.cs: Added a test for table-driven
+ comparisons, by example with strings.
+
+2008-12-22 Néstor Salceda <nestor.salceda@gmail.com>
+
* AvoidSwitchStatementsTest.cs: New. Unit tests for
AvoidSwitchStatementsRule.