diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2008-02-15 23:07:39 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2008-02-15 23:07:39 +0300 |
commit | 8ac5f814fd3adb7c89b333cbf2ba741f5299c1f5 (patch) | |
tree | 5121a01b997d8bef9275eba5efbe9404e40c123f /gendarme/rules | |
parent | 88445327e70babe201c5509f2df2e1095a2d5568 (diff) |
2008-02-15 Sebastien Pouliot <sebastien@ximian.com>
* GtkSharpExecutableTargetTest.cs
* SystemWindowsFormsExecutableTargetTest.cs
* UseSTAThreadAttributeOnSWFEntryPointsTest.cs
Updated unit tests wrt framework changes.
svn path=/trunk/mono-tools/; revision=95817
Diffstat (limited to 'gendarme/rules')
4 files changed, 32 insertions, 29 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog b/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog index 294867ac..fa41e22e 100644 --- a/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog +++ b/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog @@ -1,3 +1,10 @@ +2008-02-15 Sebastien Pouliot <sebastien@ximian.com> + + * GtkSharpExecutableTargetTest.cs + * SystemWindowsFormsExecutableTargetTest.cs + * UseSTAThreadAttributeOnSWFEntryPointsTest.cs + Updated unit tests wrt framework changes. + 2008-01-21 Sebastien Pouliot <sebastien@ximian.com> * UseSTAThreadAttributeOnSWFEntryPointsTest.cs: New. Unit tests diff --git a/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs b/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs index 1d4bb678..07da3f5f 100644 --- a/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs +++ b/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs @@ -4,7 +4,7 @@ // Authors: // Sebastien Pouliot <sebastien@ximian.com> // -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) +// Copyright (C) 2006,2008 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -42,11 +42,13 @@ namespace Tests.Rules.Ui { public class GtkSharpExecutableTargetTest { private IAssemblyRule rule; + private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { rule = new GtkSharpExecutableTargetRule (); + runner = new TestRunner (rule); } [Test] @@ -54,7 +56,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (Assembly.GetExecutingAssembly ().Location); // this (unit test) assembly is a library (dll) and has no entry point - Assert.IsNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] @@ -62,7 +64,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (ExecutableTargetTest.conexe_exe); // this assembly is a executable (exe) but doesn't refer to SWF - Assert.IsNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] @@ -70,7 +72,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (ExecutableTargetTest.gtk_winexe_exe); // this assembly is a executable (exe), refer to gtk-sharp and is compiled with /winexe - Assert.IsNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (assembly)); } [Test] @@ -78,7 +80,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (ExecutableTargetTest.gtkexe_exe); // this assembly is a executable (exe) and refer to gtk-sharp but isn't compiled with /winexe - Assert.IsNotNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (assembly)); } } } diff --git a/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs b/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs index bbd1d8f6..1c555af6 100644 --- a/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs +++ b/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs @@ -4,7 +4,7 @@ // Authors: // Sebastien Pouliot <sebastien@ximian.com> // -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) +// Copyright (C) 2006,2008 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -42,11 +42,13 @@ namespace Tests.Rules.Ui { public class SystemWindowsFormsExecutableTargetTest { private IAssemblyRule rule; + private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { rule = new SystemWindowsFormsExecutableTargetRule (); + runner = new TestRunner (rule); } [Test] @@ -54,7 +56,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (Assembly.GetExecutingAssembly ().Location); // this (unit test) assembly is a library (dll) and has no entry point - Assert.IsNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] @@ -62,7 +64,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (ExecutableTargetTest.conexe_exe); // this assembly is a executable (exe) but doesn't refer to SWF - Assert.IsNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] @@ -70,7 +72,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (ExecutableTargetTest.swf_winexe_exe); // this assembly is a executable (exe), refer to SWF and is compiled with /winexe - Assert.IsNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (assembly)); } [Test] @@ -78,7 +80,7 @@ namespace Tests.Rules.Ui { { AssemblyDefinition assembly = AssemblyFactory.GetAssembly (ExecutableTargetTest.swfexe_exe); // this assembly is a executable (exe) and refer to SWF but isn't compiled with /winexe - Assert.IsNotNull (rule.CheckAssembly (assembly, new MinimalRunner ())); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (assembly)); } } } diff --git a/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs b/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs index 6faea922..bb7ea35c 100644 --- a/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs +++ b/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs @@ -72,16 +72,16 @@ namespace Test.Rules.Ui { public class UseSTAThreadAttributeOnSWFEntryPointsTest { private UseSTAThreadAttributeOnSWFEntryPointsRule rule; + private TestRunner runner; private AssemblyDefinition assembly; - private Runner runner; [TestFixtureSetUp] public void FixtureSetUp () { - rule = new UseSTAThreadAttributeOnSWFEntryPointsRule (); string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyFactory.GetAssembly (unit); - runner = new MinimalRunner (); + rule = new UseSTAThreadAttributeOnSWFEntryPointsRule (); + runner = new TestRunner (rule); } private AssemblyDefinition GetAssemblyAndInject<TInjectedType> (bool SWF) @@ -115,57 +115,49 @@ namespace Test.Rules.Ui { [Test] public void TestNoEntryPoint () { - MessageCollection messages = rule.CheckAssembly (assembly, runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] public void TestNoTANonSWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<NoAttributesMain> (false), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (GetAssemblyAndInject<NoAttributesMain> (false))); } [Test] public void TestNoTASWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<NoAttributesMain> (true), runner); - Assert.IsNotNull (messages); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<NoAttributesMain> (true))); } [Test] public void TestSTANonSWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<STAThreadMain> (false), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (GetAssemblyAndInject<STAThreadMain> (false))); } [Test] public void TestMTANonSWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<MTAThreadMain> (false), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (GetAssemblyAndInject<MTAThreadMain> (false))); } [Test] public void TestSTAThreadSWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<STAThreadMain> (true), runner); - Assert.IsNull (messages); + Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (GetAssemblyAndInject<STAThreadMain> (true))); } [Test] public void TestMTAThreadSWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<MTAThreadMain> (true), runner); - Assert.IsNotNull (messages); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<MTAThreadMain> (true))); } [Test] public void TestSTAAndMTAThreadSWFAssembly () { - MessageCollection messages = rule.CheckAssembly (GetAssemblyAndInject<BothSTAAndMTAThreadMain> (true), runner); - Assert.IsNotNull (messages); + Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject<BothSTAAndMTAThreadMain> (true))); } } } |