Author: spouliot
Date: 2008-02-15 15:07:39 -0500 (Fri, 15 Feb 2008)
New Revision: 95817
Modified:
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs
Log:
2008-02-15 Sebastien Pouliot <[EMAIL PROTECTED]>
* GtkSharpExecutableTargetTest.cs
* SystemWindowsFormsExecutableTargetTest.cs
* UseSTAThreadAttributeOnSWFEntryPointsTest.cs
Updated unit tests wrt framework changes.
Modified: trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog
===================================================================
--- trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog
2008-02-15 20:04:48 UTC (rev 95816)
+++ trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog
2008-02-15 20:07:39 UTC (rev 95817)
@@ -1,3 +1,10 @@
+2008-02-15 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * GtkSharpExecutableTargetTest.cs
+ * SystemWindowsFormsExecutableTargetTest.cs
+ * UseSTAThreadAttributeOnSWFEntryPointsTest.cs
+ Updated unit tests wrt framework changes.
+
2008-01-21 Sebastien Pouliot <[EMAIL PROTECTED]>
* UseSTAThreadAttributeOnSWFEntryPointsTest.cs: New. Unit tests
Modified:
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs
===================================================================
---
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs
2008-02-15 20:04:48 UTC (rev 95816)
+++
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs
2008-02-15 20:07:39 UTC (rev 95817)
@@ -4,7 +4,7 @@
// Authors:
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
-// 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 @@
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 @@
{
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 @@
{
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 @@
{
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 @@
{
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));
}
}
}
Modified:
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs
===================================================================
---
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs
2008-02-15 20:04:48 UTC (rev 95816)
+++
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs
2008-02-15 20:07:39 UTC (rev 95817)
@@ -4,7 +4,7 @@
// Authors:
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
-// 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 @@
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 @@
{
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 @@
{
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 @@
{
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 @@
{
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));
}
}
}
Modified:
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs
===================================================================
---
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs
2008-02-15 20:04:48 UTC (rev 95816)
+++
trunk/mono-tools/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs
2008-02-15 20:07:39 UTC (rev 95817)
@@ -72,16 +72,16 @@
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 @@
[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)));
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches