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:
authorSebastien Pouliot <sebastien@ximian.com>2008-08-15 05:25:17 +0400
committerSebastien Pouliot <sebastien@ximian.com>2008-08-15 05:25:17 +0400
commit1f8fe16324fc9e382025868d37cbfbd506e86edf (patch)
tree58e4cd24bcfc254d36bdf502d59e0d037b6d3b66 /gendarme/rules/Gendarme.Rules.Smells/Test
parentbab598e95d2ec08fe6de2856395de4953d6ddc92 (diff)
2008-08-14 Sebastien Pouliot <sebastien@ximian.com>
* AvoidSpeculativeGeneralityTest.cs: Update unit tests to the new syntax. * Tests.Rules.Smells.csproj: Add a reference to Mono.Cecil.Pdb.dll to make sure it's available when running unit tests. svn path=/trunk/mono-tools/; revision=110546
Diffstat (limited to 'gendarme/rules/Gendarme.Rules.Smells/Test')
-rw-r--r--gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSpeculativeGeneralityTest.cs41
-rw-r--r--gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog7
-rwxr-xr-xgendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj4
3 files changed, 21 insertions, 31 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSpeculativeGeneralityTest.cs b/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSpeculativeGeneralityTest.cs
index ed92cf49..8295cb59 100644
--- a/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSpeculativeGeneralityTest.cs
+++ b/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSpeculativeGeneralityTest.cs
@@ -31,9 +31,11 @@ using System.Reflection;
using System.Collections.Generic;
using Mono.Cecil;
-using NUnit.Framework;
using Gendarme.Framework;
using Gendarme.Rules.Smells;
+
+using NUnit.Framework;
+using Test.Rules.Fixtures;
using Test.Rules.Helpers;
namespace Test.Rules.Smells {
@@ -125,65 +127,42 @@ namespace Test.Rules.Smells {
}
[TestFixture]
- public class AvoidSpeculativeGeneralityTest {
- private ITypeRule rule;
- private AssemblyDefinition assembly;
- private TypeDefinition type;
- private TestRunner runner;
-
- [TestFixtureSetUp]
- public void FixtureSetUp ()
- {
- string unit = Assembly.GetExecutingAssembly ().Location;
- assembly = AssemblyFactory.GetAssembly (unit);
- rule = new AvoidSpeculativeGeneralityRule ();
- runner = new TestRunner (rule);
- }
+ public class AvoidSpeculativeGeneralityTest : TypeRuleTestFixture<AvoidSpeculativeGeneralityRule> {
[Test]
public void AbstractClassesWithoutResponsabilityTest ()
{
- type = assembly.MainModule.Types["Test.Rules.Smells.AbstractClass"];
- Assert.AreEqual (RuleResult.Failure, runner.CheckType (type));
- Assert.AreEqual (1, runner.Defects.Count);
+ AssertRuleFailure<AbstractClass> (1);
}
[Test]
public void AbstractClassesWithResponsabilityTest ()
{
- type = assembly.MainModule.Types["Test.Rules.Smells.OtherAbstractClass"];
- Assert.AreEqual (RuleResult.Success, runner.CheckType (type));
+ AssertRuleSuccess<OtherAbstractClass> ();
}
[Test]
public void ClassWithUnusedParameterTest ()
{
- type = assembly.MainModule.Types ["Test.Rules.Smells.ClassWithUnusedParameter"];
- Assert.AreEqual (RuleResult.Failure, runner.CheckType (type));
- Assert.AreEqual (1, runner.Defects.Count);
+ AssertRuleFailure<ClassWithUnusedParameter> (1);
}
[Test]
public void ClassWithFourUnusedParametersTest ()
{
- type = assembly.MainModule.Types ["Test.Rules.Smells.ClassWithFourUnusedParameters"];
- Assert.AreEqual (RuleResult.Failure, runner.CheckType (type));
- Assert.AreEqual (4, runner.Defects.Count);
+ AssertRuleFailure<ClassWithFourUnusedParameters> (4);
}
[Test]
public void ClassWithUnnecessaryDelegationTest ()
{
- type = assembly.MainModule.Types ["Test.Rules.Smells.UnnecessaryDelegatedClass"];
- Assert.AreEqual (RuleResult.Failure, runner.CheckType (type));
- Assert.AreEqual (1, runner.Defects.Count);
+ AssertRuleFailure<UnnecessaryDelegatedClass> (1);
}
[Test]
public void ClassWithoutUnnecessaryDelegationTest ()
{
- type = assembly.MainModule.Types ["Test.Rules.Smells.NotUnnecessaryDelegatedClass"];
- Assert.AreEqual (RuleResult.Success, runner.CheckType (type));
+ AssertRuleSuccess<NotUnnecessaryDelegatedClass> ();
}
}
}
diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog b/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog
index 18f8253c..312a1b1a 100644
--- a/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog
+++ b/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-14 Sebastien Pouliot <sebastien@ximian.com>
+
+ * AvoidSpeculativeGeneralityTest.cs: Update unit tests to the new
+ syntax.
+ * Tests.Rules.Smells.csproj: Add a reference to Mono.Cecil.Pdb.dll
+ to make sure it's available when running unit tests.
+
2008-08-12 Sebastien Pouliot <sebastien@ximian.com>
* AvoidLongMethodsTest.cs: Update unit tests to the new syntax.
diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj b/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj
index e05dd3ad..24dfe9bc 100755
--- a/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj
+++ b/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj
@@ -47,6 +47,10 @@
<Compile Include="AvoidSpeculativeGeneralityTest.cs" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\..\..\..\cecil\pdb\Mono.Cecil.Pdb\Mono.Cecil.Pdb.csproj">
+ <Project>{4FEBBB25-D5C0-48F0-A822-2E0D6F3D777E}</Project>
+ <Name>Mono.Cecil.Pdb</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\..\..\mcs\class\Mono.Cecil\Mono.Cecil.csproj">
<Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
<Name>Mono.Cecil</Name>