diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2008-02-15 22:54:45 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2008-02-15 22:54:45 +0300 |
commit | a22ed0764a8dc295e02e9820ee339d6d8ef2178e (patch) | |
tree | 56e7488ed1d693aa0cdae4f234e942b95c77dad0 /gendarme/rules | |
parent | 7714ce1c5622ad329f110fffe754eb0a4cda27b7 (diff) |
2008-02-15 Sebastien Pouliot <sebastien@ximian.com>
* ExitCodeIsLimitedOnUnixTest.cs
* FeatureRequiresRootPrivilegeOnUnixTest.cs
* MonoCompatibilityReviewTest.cs
* NewLineLiteralTest.cs:
Updated unit tests wrt framework changes.
svn path=/trunk/mono-tools/; revision=95810
Diffstat (limited to 'gendarme/rules')
5 files changed, 95 insertions, 105 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Portability/Test/ChangeLog b/gendarme/rules/Gendarme.Rules.Portability/Test/ChangeLog index 849fcf5d..bebdbcff 100644 --- a/gendarme/rules/Gendarme.Rules.Portability/Test/ChangeLog +++ b/gendarme/rules/Gendarme.Rules.Portability/Test/ChangeLog @@ -1,3 +1,11 @@ +2008-02-15 Sebastien Pouliot <sebastien@ximian.com> + + * ExitCodeIsLimitedOnUnixTest.cs + * FeatureRequiresRootPrivilegeOnUnixTest.cs + * MonoCompatibilityReviewTest.cs + * NewLineLiteralTest.cs: + Updated unit tests wrt framework changes. + 2007-12-29 Sebastien Pouliot <sebastien@ximian.com> * ExitCodeIsLimitedOnUnixTest.cs: New. Unit tests by Daniel Abramov diff --git a/gendarme/rules/Gendarme.Rules.Portability/Test/ExitCodeIsLimitedOnUnixTest.cs b/gendarme/rules/Gendarme.Rules.Portability/Test/ExitCodeIsLimitedOnUnixTest.cs index 81a12c58..8113454d 100644 --- a/gendarme/rules/Gendarme.Rules.Portability/Test/ExitCodeIsLimitedOnUnixTest.cs +++ b/gendarme/rules/Gendarme.Rules.Portability/Test/ExitCodeIsLimitedOnUnixTest.cs @@ -181,8 +181,8 @@ namespace Test.Rules.Portability { public class ExitCodeIsLimitedOnUnixTest { private ExitCodeIsLimitedOnUnixRule rule; + private TestRunner runner; private AssemblyDefinition assembly; - private Runner runner; private AssemblyDefinition voidMainAssembly; private TypeDefinition envSetExitCodeTester; @@ -191,10 +191,10 @@ namespace Test.Rules.Portability { [TestFixtureSetUp] public void FixtureSetUp () { - rule = new ExitCodeIsLimitedOnUnixRule (); string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyFactory.GetAssembly (unit); - runner = new MinimalRunner (); + rule = new ExitCodeIsLimitedOnUnixRule (); + runner = new TestRunner (rule); // generate void Main () assembly voidMainAssembly = AssemblyFactory.DefineAssembly ("GoodAssembly", AssemblyKind.Console); @@ -210,15 +210,6 @@ namespace Test.Rules.Portability { Assert.IsNotNull (envExitTester); } - 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 AssemblyDefinition GetAssemblyAndInject<TInjectedType> () where TInjectedType : CommonMainClass { @@ -252,166 +243,147 @@ namespace Test.Rules.Portability { [Test] public void TestVoidMainAssembly () { - Assert.IsNull (rule.CheckAssembly (voidMainAssembly, runner)); + Assert.AreEqual (RuleResult.DoesNotApply, rule.CheckAssembly (voidMainAssembly)); } [Test] public void TestGoodIntMainAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<GoodIntMainClass> (), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (GetAssemblyAndInject<GoodIntMainClass> ())); } [Test] public void TestUnsureIntMainAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<UnsureIntMainClass> (), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Warning); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<UnsureIntMainClass> ()), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.Low, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestTooBigReturnedAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<TooBigReturnedMainClass> (), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<TooBigReturnedMainClass> ()), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestMinusOneReturnedAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<MinusOneReturnedMainClass> (), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<MinusOneReturnedMainClass> ()), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestSmallNegativeReturnedAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<SmallNegativeReturnedMainClass> (), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<SmallNegativeReturnedMainClass> ()), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetBadExitCodeFromNonExecutable () { // get method from this assembly, not generated one - MessageCollection messages = rule.CheckMethod (GetMethod (assembly.MainModule.Types ["Test.Rules.Portability.EnvSetExitCodeTester"], "SetTooBigExitCode"), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethod (assembly.MainModule.Types ["Test.Rules.Portability.EnvSetExitCodeTester"], "SetTooBigExitCode"))); } [Test] public void TestNoEnvSetExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvSetExitCodeTest ("EmptyMethod"), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("EmptyMethod"))); } [Test] public void TestEnvSetGoodExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetGoodExitCode"), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetGoodExitCode"))); } [Test] public void TestEnvSetMinusOneExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetMinusOneExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetMinusOneExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetSmallNegativeExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetSmallNegativeExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetSmallNegativeExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetTooBigExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetTooBigExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetTooBigExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetUnsureExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetUnsureExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Warning); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetUnsureExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.Low, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithBadExitCodeFromNonExecutable () { // get method from this assembly, not generated one - MessageCollection messages = rule.CheckMethod (GetMethod (assembly.MainModule.Types ["Test.Rules.Portability.EnvExitTester"], "ExitWithTooBigExitCode"), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethod (assembly.MainModule.Types ["Test.Rules.Portability.EnvExitTester"], "ExitWithTooBigExitCode"))); } [Test] public void TestNoEnvExit () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvExitTest ("EmptyMethod"), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (GetMethodForEnvExitTest ("EmptyMethod"))); } [Test] public void TestEnvExitWithGoodExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvExitTest ("ExitWithGoodExitCode"), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithGoodExitCode"))); } [Test] public void TestEnvExitWithMinusOneExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvExitTest ("ExitWithMinusOneExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithMinusOneExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithSmallNegativeExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvExitTest ("ExitWithSmallNegativeExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithSmallNegativeExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithTooBigExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvExitTest ("ExitWithTooBigExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Error); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithTooBigExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithUnsureExitCode () { - MessageCollection messages = rule.CheckMethod (GetMethodForEnvExitTest ("ExitWithUnsureExitCode"), runner); - Assert.IsNotNull (messages); - Assert.AreEqual (1, messages.Count); - CheckMessageType (messages, MessageType.Warning); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithUnsureExitCode")), "RuleResult"); + Assert.AreEqual (1, runner.Defects.Count, "Count"); + Assert.AreEqual (Confidence.Low, runner.Defects [0].Confidence, "Confidence"); } } } diff --git a/gendarme/rules/Gendarme.Rules.Portability/Test/FeatureRequiresRootPrivilegeOnUnixTest.cs b/gendarme/rules/Gendarme.Rules.Portability/Test/FeatureRequiresRootPrivilegeOnUnixTest.cs index 29b7d2da..50af181e 100644 --- a/gendarme/rules/Gendarme.Rules.Portability/Test/FeatureRequiresRootPrivilegeOnUnixTest.cs +++ b/gendarme/rules/Gendarme.Rules.Portability/Test/FeatureRequiresRootPrivilegeOnUnixTest.cs @@ -45,6 +45,7 @@ namespace Test.Rules.Portability { public class FeatureRequiresRootPrivilegeOnUnixTest { private FeatureRequiresRootPrivilegeOnUnixRule rule; + private TestRunner runner; private AssemblyDefinition assembly; private TypeDefinition type; @@ -97,6 +98,7 @@ namespace Test.Rules.Portability { assembly = AssemblyFactory.GetAssembly (unit); type = assembly.MainModule.Types ["Test.Rules.Portability.FeatureRequiresRootPrivilegeOnUnixTest"]; rule = new FeatureRequiresRootPrivilegeOnUnixRule (); + runner = new TestRunner (rule); } private MethodDefinition GetTest (string name) @@ -112,21 +114,21 @@ namespace Test.Rules.Portability { public void TestSetPriority () { MethodDefinition method = GetTest ("SetPriority"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestSetMyPriority () { MethodDefinition method = GetTest ("SetMyPriority"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestSetPriorityNormal () { MethodDefinition method = GetTest ("SetPriorityNormal"); //allowed value - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] @@ -134,7 +136,7 @@ namespace Test.Rules.Portability { public void TestSetPriorityNormalVariable () { MethodDefinition method = GetTest ("SetPriorityNormalVariable"); - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] @@ -142,21 +144,21 @@ namespace Test.Rules.Portability { { TypeDefinition type = assembly.MainModule.Types ["Test.Rules.Portability.MyPing"]; //this class extends Ping MethodDefinition method = type.Constructors [0]; //the constructor calls the base constructor - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestCreatePing () { MethodDefinition method = GetTest ("CreatePing"); // calls new Ping () - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestCreateObject () { MethodDefinition method = GetTest ("CreateObject"); //calls new object() - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] @@ -164,7 +166,7 @@ namespace Test.Rules.Portability { { // use an already created Ping instance MethodDefinition method = GetTest ("UsePing"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } } } diff --git a/gendarme/rules/Gendarme.Rules.Portability/Test/MonoCompatibilityReviewTest.cs b/gendarme/rules/Gendarme.Rules.Portability/Test/MonoCompatibilityReviewTest.cs index f9e11a9e..299cc405 100644 --- a/gendarme/rules/Gendarme.Rules.Portability/Test/MonoCompatibilityReviewTest.cs +++ b/gendarme/rules/Gendarme.Rules.Portability/Test/MonoCompatibilityReviewTest.cs @@ -42,6 +42,7 @@ namespace Test.Rules.Portability { public class MonoCompatibilityReviewTest { private MonoCompatibilityReviewRule rule; + private TestRunner runner; private AssemblyDefinition assembly; private TypeDefinition type; @@ -73,18 +74,18 @@ namespace Test.Rules.Portability { assembly = AssemblyFactory.GetAssembly (unit); type = assembly.MainModule.Types ["Test.Rules.Portability.MonoCompatibilityReviewTest"]; rule = new MonoCompatibilityReviewRule (); + runner = new TestRunner (rule); } [SetUp] public void SetUp () { - rule.NotImplemented = new Dictionary<string, string> (); + rule.NotImplemented.Clear (); rule.NotImplemented.Add ("System.Int32 System.Object::GetHashCode()", null); - rule.Missing = new Dictionary<string, string> (); + rule.Missing.Clear (); rule.Missing.Add ("System.String System.Object::ToString()", null); - rule.Todo = new Dictionary<string, string> (); - rule.Todo.Add ("System.Type System.Object::GetType()", "TODO"); - rule.DownloadException = null; + rule.ToDo.Clear (); + rule.ToDo.Add ("System.Type System.Object::GetType()", "TODO"); } private MethodDefinition GetTest (string name) @@ -100,34 +101,34 @@ namespace Test.Rules.Portability { public void TestNotImplemented () { MethodDefinition method = GetTest ("NotImplemented"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, rule.CheckMethod (method)); } [Test] public void TestMissing () { MethodDefinition method = GetTest ("Missing"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestTODO () { MethodDefinition method = GetTest ("TODO"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestFalsePositive () { MethodDefinition method = GetTest ("FalsePositive"); - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestOneTimeWarning () { - //inject some values +/* //inject some values rule.DownloadException = new System.Net.WebException ("FAIL"); MethodDefinition method = GetTest ("FalsePositive"); @@ -136,24 +137,29 @@ namespace Test.Rules.Portability { Assert.AreEqual (1, result.Count); //should only warn once - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ()));*/ } - [Test] - [Ignore ("This test takes a few seconds.")] - public void TestDefinitionDownload () + private void DeleteDefinitionData () { string localAppDataFolder = Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData); string definitionsFolder = Path.Combine (localAppDataFolder, "Gendarme"); string definitionsFile = Path.Combine (definitionsFolder, "definitions.zip"); if (File.Exists (definitionsFile)) File.Delete (definitionsFile); + } + + [Test] + [Ignore ("This test takes a few seconds.")] + public void TestDefinitionDownload () + { + DeleteDefinitionData (); MonoCompatibilityReviewRule rule = new MonoCompatibilityReviewRule (); + rule.Initialize (new TestRunner (rule)); Assert.IsNotNull (rule.Missing); Assert.IsNotNull (rule.NotImplemented); - Assert.IsNotNull (rule.Todo); - Assert.IsNull (rule.DownloadException); + Assert.IsNotNull (rule.ToDo); } } } diff --git a/gendarme/rules/Gendarme.Rules.Portability/Test/NewLineLiteralTest.cs b/gendarme/rules/Gendarme.Rules.Portability/Test/NewLineLiteralTest.cs index fc11f1ed..57d7203e 100644 --- a/gendarme/rules/Gendarme.Rules.Portability/Test/NewLineLiteralTest.cs +++ b/gendarme/rules/Gendarme.Rules.Portability/Test/NewLineLiteralTest.cs @@ -40,6 +40,7 @@ namespace Test.Rules.Portability { public class NewLineTest { private IMethodRule rule; + private TestRunner runner; private AssemblyDefinition assembly; private TypeDefinition type; @@ -80,6 +81,7 @@ namespace Test.Rules.Portability { assembly = AssemblyFactory.GetAssembly (unit); type = assembly.MainModule.Types ["Test.Rules.Portability.NewLineTest"]; rule = new NewLineLiteralRule (); + runner = new TestRunner (rule); } private MethodDefinition GetTest (string name) @@ -95,42 +97,42 @@ namespace Test.Rules.Portability { public void HasNewLineLiteral_13 () { MethodDefinition method = GetTest ("GetNewLineLiteral_13"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void HasNewLineLiteral_10 () { MethodDefinition method = GetTest ("GetNewLineLiteral_10"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void HasNewLineLiteral () { MethodDefinition method = GetTest ("GetNewLineLiteral"); - Assert.IsNotNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void HasNewLine () { MethodDefinition method = GetTest ("GetNewLine"); - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void HasNull () { MethodDefinition method = GetTest ("GetNull"); - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void HasEmpty () { MethodDefinition method = GetTest ("GetEmpty"); - Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } } } |