<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://www.codeplex.com/rss.xsl"?><rss version="2.0"><channel><title>Automatic Class Tester</title><link>http://www.codeplex.com/classtester/Project/ProjectRss.aspx</link><description>Automatically unit test your model&amp;#58;   - Automatically test properties, spotting any miswired getters or setters   - Increase code coverage, reaching parts manual tests don&amp;#39;t even try to   - Supports igno...</description><item><title>Reviewed: 1.1.2925.23829 (Oct 30, 2008)</title><link>http://www.codeplex.com/classtester/Release/ProjectReleases.aspx?ReleaseId=9592</link><description>Rated 5 Stars (out of 5) - Not only is this great for helping us maintain our code coverage goals, it helps find mis-wired properties for us.  Even though we use automatic properties wherever possible, there are times that we cannot use them and bring the risk of human error to the party.  Indispensable tool!</description><author>jferris</author><pubDate>Thu, 30 Oct 2008 17:25:24 GMT</pubDate><guid isPermaLink="false">Reviewed: 1.1.2925.23829 (Oct 30, 2008) 20081030052524P</guid></item><item><title>COMMENTED ISSUE: Add support for Abstract Types and Interfaces to the TypeFactory</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3093</link><description>Use a mock repository to add support for abstract types &amp;#40;abstract classes and interfaces&amp;#41; to the TypeFactory&lt;br /&gt;Comments: ** Comment from web user: furie ** &lt;p&gt;This can be done now by extending the TypeFactory an instance of it to a tester constructor.&lt;br /&gt;using Castle.Core.Interceptor&amp;#59;&lt;br /&gt;using Castle.DynamicProxy&amp;#59;&lt;br /&gt;public class MyTypeFactory &amp;#58; TypeFactory&lt;br /&gt;&amp;#123;&lt;br /&gt;static ProxyGenerator proxyGenerator &amp;#61; new ProxyGenerator&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;public override object CreateRandomValue&amp;#40;Type type&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;if &amp;#40;type.IsInterface&amp;#41;&lt;br /&gt; return proxyGenerator.CreateInterfaceProxyWithoutTarget&amp;#40;type, new StandardInterceptor&amp;#40;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;return base.CreateRandomValue&amp;#40;type&amp;#41;&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;public override bool CanCreateInstance&amp;#40;Type type&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;bool result &amp;#61; base.CanCreateInstance&amp;#40;type&amp;#41;&amp;#59;&lt;br /&gt;if &amp;#40;&amp;#33;result&amp;#41;&lt;br /&gt; result &amp;#61; type.IsInterface &amp;#38;&amp;#38; &amp;#33;type.IsGenericTypeDefinition&amp;#59;&lt;br /&gt;retur result&amp;#59;&lt;br /&gt;&amp;#125;&lt;/p&gt;</description><author>furie</author><pubDate>Thu, 07 Feb 2008 15:28:30 GMT</pubDate><guid isPermaLink="false">COMMENTED ISSUE: Add support for Abstract Types and Interfaces to the TypeFactory 20080207032830P</guid></item><item><title>COMMENTED ISSUE: PropertyChecker to optionally test properties throw ArgumentNullException when setting null value</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3543</link><description>Often a precondition of a property is that the value set is non null and therefore the property should throw an ArgumentNullExtension. Would be good to switch this checking on at class level. Also optionally checking string.Empty throws would be great also.&lt;br /&gt;Comments: ** Comment from web user: furie ** &lt;p&gt;Actually I think this would be better implemented as a seperate &amp;#39;NullParam&amp;#39; tester that tested Constructors, Properties, and Methods.&lt;/p&gt;</description><author>furie</author><pubDate>Thu, 07 Feb 2008 15:16:59 GMT</pubDate><guid isPermaLink="false">COMMENTED ISSUE: PropertyChecker to optionally test properties throw ArgumentNullException when setting null value 20080207031659P</guid></item><item><title>CREATED ISSUE: PropertyChecker to optionally test properties throw ArgumentNullException when setting null value</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3543</link><description>Often a precondition of a property is that the value set is non null and therefore the property should throw an ArgumentNullExtension. Would be good to switch this checking on at class level. Also optionally checking string.Empty throws would be great also.&lt;br /&gt;</description><author>furie</author><pubDate>Thu, 07 Feb 2008 11:12:34 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: PropertyChecker to optionally test properties throw ArgumentNullException when setting null value 20080207111234A</guid></item><item><title>COMMENTED ISSUE: Add support for Abstract Types and Interfaces to the TypeFactory</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3093</link><description>Use a mock repository to add support for abstract types &amp;#40;abstract classes and interfaces&amp;#41; to the TypeFactory&lt;br /&gt;Comments: ** Comment from web user: furie ** &lt;p&gt;Consider using Castle DynamicProxy 2 to create an instance of an abstract class. It&amp;#39;s lightweight, quick and simple. RhinoMocks uses it to create its mocks.&lt;/p&gt;</description><author>furie</author><pubDate>Thu, 07 Feb 2008 10:59:53 GMT</pubDate><guid isPermaLink="false">COMMENTED ISSUE: Add support for Abstract Types and Interfaces to the TypeFactory 20080207105953A</guid></item><item><title>CREATED ISSUE: Strongly signed assemblies</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3432</link><description>Hello,&lt;br /&gt;&lt;br /&gt;Thanks for a great tool and a great idea. The only thing I really miss is being able to use the library in a strongly signed test projects. Would it be possible for you to include this in the next release&amp;#63;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Igor&lt;br /&gt;</description><author>igorbrejc</author><pubDate>Wed, 30 Jan 2008 08:18:51 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Strongly signed assemblies 20080130081851A</guid></item><item><title>Source code checked in</title><link>http://www.codeplex.com/classtester/SourceControl/ListDownloadableCommits.aspx</link><description>Added AddPropertyExclusions and AddConstructorExclusion to the AssemblyTester</description><author>molmorg</author><pubDate>Wed, 16 Jan 2008 09:52:45 GMT</pubDate><guid isPermaLink="false">Source code checked in 20080116095245A</guid></item><item><title>COMMENTED ISSUE: Compare two provided objects instead of comparing randomly generated value</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3129</link><description>Comparing randomly genrated values is great for detecting bugs where a public property uses the wrong private field. Another test that would also be very useful is to compare all the properties of two provided objects. What I&amp;#39;m envisioning is something like this &amp;#40;this is only psendo-code&amp;#41;&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;TestMethod&amp;#93;&lt;br /&gt;public void TestPerson&amp;#40;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;    Person p1 &amp;#61; new Person&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;    p1.Name &amp;#61; &amp;#34;Bob Smith&amp;#34;&amp;#59;&lt;br /&gt;    string personId &amp;#61; MyDAL.Save&amp;#40;p1&amp;#41;&amp;#59;&lt;br /&gt;    Person p2 &amp;#61; MyDAL.Fetch&amp;#40;personId&amp;#41;&amp;#59;&lt;br /&gt;    PropertyTester tester &amp;#61; new PropertyTester&amp;#40;p1, p2&amp;#41;&amp;#59;&lt;br /&gt;    tester.TestProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;Comments: ** Comment from web user: Jericho ** &lt;p&gt;I just submitted a patch with the code for a &amp;#34;PropertyComparer&amp;#34; class that will compare all the properties on two objects to make sure that the values are the same.&lt;/p&gt;</description><author>Jericho</author><pubDate>Fri, 11 Jan 2008 17:14:27 GMT</pubDate><guid isPermaLink="false">COMMENTED ISSUE: Compare two provided objects instead of comparing randomly generated value 20080111051427P</guid></item><item><title>Patch Uploaded</title><link>http://www.codeplex.com/classtester/SourceControl/PatchList.aspx</link><description>
&lt;p&gt;&lt;a href='/UserAccount/UserProfile.aspx?UserName=Jericho'&gt;Jericho&lt;/a&gt; has uploaded a patch.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Description:&lt;/b&gt;&lt;br /&gt;I wrote a new tester to compare the properties of two provided objects. Here&amp;#39;s a unit test example that demonstrates how it works&amp;#58;&lt;br /&gt;&lt;br /&gt;using System&amp;#59;&lt;br /&gt;using System.Collections.Generic&amp;#59;&lt;br /&gt;using Microsoft.VisualStudio.TestTools.UnitTesting&amp;#59;&lt;br /&gt;using TheJoyOfCode.QualityTools.Tests.TestSubjects&amp;#59;&lt;br /&gt;using Rhino.Mocks&amp;#59;&lt;br /&gt;&lt;br /&gt;namespace TheJoyOfCode.QualityTools.Tests&lt;br /&gt;&amp;#123;&lt;br /&gt;    &amp;#91;TestClass&amp;#93;&lt;br /&gt;    public class PropertyComparerTest&lt;br /&gt;    &amp;#123;&lt;br /&gt;        &amp;#91;TestMethod&amp;#93;&lt;br /&gt;        public void CompareProperties_Good&amp;#40;&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            DummyGood dummy1 &amp;#61; new DummyGood&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            dummy1.Bool &amp;#61; true&amp;#59;&lt;br /&gt;&lt;br /&gt;            DummyGood dummy2 &amp;#61; new DummyGood&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            dummy2.Bool &amp;#61; true&amp;#59;&lt;br /&gt;&lt;br /&gt;            PropertyComparer comparer &amp;#61; new  PropertyComparer&amp;#40;dummy1, dummy2&amp;#41;&amp;#59;&lt;br /&gt;            comparer.CompareProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        &amp;#91;TestMethod&amp;#93;&lt;br /&gt;        &amp;#91;ExpectedException&amp;#40;typeof&amp;#40;PropertyCompareException&amp;#41;&amp;#41;&amp;#93;&lt;br /&gt;        public void CompareProperties_PropertiesDifferent&amp;#40;&amp;#41; &amp;#123;&lt;br /&gt;            DummyGood dummy1 &amp;#61; new DummyGood&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            dummy1.Bool &amp;#61; true&amp;#59;&lt;br /&gt;&lt;br /&gt;            DummyGood dummy2 &amp;#61; new DummyGood&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            dummy2.Bool &amp;#61; false&amp;#59;&lt;br /&gt;&lt;br /&gt;            PropertyComparer comparer &amp;#61; new PropertyComparer&amp;#40;dummy1, dummy2&amp;#41;&amp;#59;&lt;br /&gt;            comparer.CompareProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        &amp;#91;TestMethod&amp;#93;&lt;br /&gt;        &amp;#91;ExpectedException&amp;#40;typeof&amp;#40;PropertyCompareException&amp;#41;&amp;#41;&amp;#93;&lt;br /&gt;        public void CompareProperties_TypesDifferent&amp;#40;&amp;#41; &amp;#123;&lt;br /&gt;            DummyGood dummy1 &amp;#61; new DummyGood&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            dummy1.Bool &amp;#61; true&amp;#59;&lt;br /&gt;&lt;br /&gt;            DummyNoEvent dummy2 &amp;#61; new DummyNoEvent&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;            dummy2.SomeInt &amp;#61; 8&amp;#59;&lt;br /&gt;&lt;br /&gt;            PropertyComparer comparer &amp;#61; new PropertyComparer&amp;#40;dummy1, dummy2&amp;#41;&amp;#59;&lt;br /&gt;            comparer.CompareProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#125;&lt;/p&gt;</description><author>Jericho</author><pubDate>Fri, 11 Jan 2008 17:13:05 GMT</pubDate><guid isPermaLink="false">Patch Uploaded 20080111051305P</guid></item><item><title>CLOSED ISSUE: Add support for creation of Arrays to TypeFactory</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3097</link><description>TypeFactory can&amp;#39;t currently create arrays &amp;#40;e.g. object&amp;#91;&amp;#93;&amp;#41;&lt;br /&gt;</description><author>molmorg</author><pubDate>Wed, 09 Jan 2008 17:31:08 GMT</pubDate><guid isPermaLink="false">CLOSED ISSUE: Add support for creation of Arrays to TypeFactory 20080109053108P</guid></item><item><title>Source code checked in</title><link>http://www.codeplex.com/classtester/SourceControl/ListDownloadableCommits.aspx</link><description>Added support for creation of Arrays. The array is created with a random number of empty elements &amp;#40;up to 50&amp;#41;.</description><author>molmorg</author><pubDate>Wed, 09 Jan 2008 17:31:06 GMT</pubDate><guid isPermaLink="false">Source code checked in 20080109053106P</guid></item><item><title>UPDATED WIKI: AssemblyTester</title><link>http://www.codeplex.com/classtester/Wiki/View.aspx?title=AssemblyTester&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
The AssemblyTester
&lt;/h1&gt; &lt;br /&gt;The AssemblyTester uses the &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=PropertyTester&amp;amp;referringTitle=AssemblyTester"&gt;PropertyTester&lt;/a&gt; and &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=ConstructorTester&amp;amp;referringTitle=AssemblyTester"&gt;ConstructorTester&lt;/a&gt; and can remove much of the coding previously required to use them by applying these tests to all the types in an assembly, subject to exclusions that you can specify.&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
How it works
&lt;/h3&gt; &lt;br /&gt;To test an assembly simply create an instance of the AssemblyTester passing it the name of the Assembly to test.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
AssemblyTester tester = new AssemblyTester(&amp;quot;TheJoyOfCode.QualityTools&amp;quot;);
&lt;/pre&gt; &lt;br /&gt;Now you can call the AssemblyTesters TestAssembly method which looks like this:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     public void TestAssembly(bool testProperties, bool testConstructors)
&lt;/pre&gt; &lt;br /&gt;The testProperties and testConstructors parameters should be fairly self explanatory!&lt;br /&gt; &lt;br /&gt;The example below aims to test both constructors and properties in the &amp;quot;TheJoyOfCode.QualityTools.Tests.DummyProject&amp;quot; assembly.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     AssemblyTester tester = new AssemblyTester(&amp;quot;ExampleAssembly&amp;quot;);
     tester.TestAssembly(true, true);
&lt;/pre&gt; &lt;br /&gt;The AssemblyTester will throw an exception with a detailed description of errors encountered when testing an assembly. Here's an example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
AssemblyTesterTest.AssemblyTester_PassWithExclusions : FailedTheJoyOfCode.QualityTools.AssemblyTestException: 
Testing the assembly TheJoyOfCode.QualityTools.Tests.DummyProject produced the following errors:
------------
The get value of the 'Dummy4' property on the type 'TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties' 
did not equal the set value (in: '', out: 'fe6faacc-3ea8-45a0-8c5c-dc2e0021065b')
 [TestProperties,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties]
 
The value of the 'Dummy1' property did not equal the value set with the 'dummy1' 
constructor parameter (in: 'cf04ca44-73dc-4147-bb3e-2a1a0d2c52b3', out: '819e635d-4dc6-4e6c-b141-75f0212cb242')
 [TestConstructors,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectConstructors]
 
The type TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1 is an open 
Generic Definition (e.g. Class&amp;lt;T&amp;gt;. Only closed generic types Class&amp;lt;int&amp;gt; are currently supported.
 [TestConstructors,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1[T]]
 
Cannot create an instance of TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1[T] 
because Type.ContainsGenericParameters is true. 
[TestProperties,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1[T]]
&lt;/pre&gt; &lt;br /&gt;Not all types in an assembly qualify for automatic testing of constructors or properties. Looking at the errors produced above it is clear that the two first errors are should be fixed (A property which is not mapped correctly and a constructor which does not map correctly to the corresponding property). The last two errors indicates that the AssemblyTester can not test this particular type because it contains generic parameters.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Exclusions
&lt;/h2&gt; &lt;br /&gt;To still use the AssemblyTester on this module we can skip these last two issues. This can be done in two ways, specifying one or more types to exclude or specifying a namespace to exclude. &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Excluding a type
&lt;/h3&gt; &lt;br /&gt;The example excludes the class which is not qualified for automatic testing to the AssemblyTester.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     AssemblyTester tester = new AssemblyTester(&amp;quot;TheJoyOfCode.QualityTools.Tests.DummyProject&amp;quot;);
     tester.Exclusions.AddType(typeof(GenericClass&amp;lt;&amp;gt;));
     tester.TestAssembly(AssemblyTester.TestTarget.Properties | AssemblyTester.TestTarget.Constructors);
&lt;/pre&gt; &lt;br /&gt;When running the test again the AssemblyTester only produces the following errors.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
TheJoyOfCode.QualityTools.AssemblyTestException: Testing the assembly 
TheJoyOfCode.QualityTools.Tests.DummyProject produced the following errors:
------------
The get value of the 'Dummy4' property on the type 'TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties' 
did not equal the set value (in: '', out: '1e5101b5-e9e9-4d69-b13c-83863f70a7b6')
 [TestProperties,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties]
 
The value of the 'Dummy1' property did not equal the value set with the 'dummy1' 
constructor parameter (in: '2bf2002e-b505-4413-a8f9-97036c40f720', out: '8a447a00-2f17-4d27-bb25-1fc66bf2c39d')
 [TestConstructors,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectConstructors]
&lt;/pre&gt; &lt;br /&gt;The errors above are errors which the AssemblyTester has been designed to detect; errors in mapping properties to fields and mapping values to constructors. So to make the test pass we need to fix those errors!&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Excluding a namespace
&lt;/h3&gt; &lt;br /&gt;The example below excludes all types in the namepace &amp;quot;ExampleAssembly.SomeNamespace&amp;quot; namespace &lt;b&gt;but does not exclude types in any sub namespaces.&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     tester.Exclusions.AddNamespace(&amp;quot;ExampleAssembly.SomeNamespace&amp;quot;, false);
&lt;/pre&gt; &lt;br /&gt;We could specify that all types within a numespace and sub-namespaces are excluded like so:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     tester.Exclusions.AddNamespace(&amp;quot;ExampleAssembly.SomeNamespace&amp;quot;, true);
&lt;/pre&gt; &lt;br /&gt;For example, this would also exclude any type in the &amp;quot;ExampleAssembly.SomeNamespace.SomeSubNamespace&amp;quot; too.&lt;br /&gt; &lt;br /&gt;You can have as many exclusions as you like and can combine type exclusions with namespace exclusions. Easy peasy.&lt;br /&gt; &lt;br /&gt;If you need to exclude a type from an assembly test because of one &lt;i&gt;funky&lt;/i&gt; property or constructor you can always target that type directly with the &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=PropertyTester&amp;amp;referringTitle=AssemblyTester"&gt;PropertyTester&lt;/a&gt; or &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=ConstructorTester&amp;amp;referringTitle=AssemblyTester"&gt;ConstructorTester&lt;/a&gt; and exclude the property/type specifically. Best of both worlds.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Adding your own exclusion rules
&lt;/h2&gt;It's easy to extend the exclusion policies available in the AssemblyTester by creating your own class that inherits from TestExclusion. Imagine you want to be able to exclude any class that starts with the letter 'S'. First we need a new &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
private class StartsWithSExclusion : TestExclusion
{
    public override bool IsExcluded(Type type)
    {
        return type.Name.StartsWith(&amp;quot;S&amp;quot;);
    }
}
&lt;/pre&gt; &lt;br /&gt;Now we just have to add that type to the Exclusions as follows:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     tester.Exclusions.Add(new StartsWithSExclusion());
&lt;/pre&gt; &lt;br /&gt;... and any types whose name starts with an S won't be tested.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
FAQ
&lt;/h2&gt; &lt;br /&gt;&lt;b&gt;Q:&lt;/b&gt; It's nice that I can exclude whole types and namespaces using the AssemblyTester but why can't I specify a single property on a type that should be excluded.&lt;br /&gt;&lt;b&gt;A:&lt;/b&gt; This feature is deliberately not included to date. The practice in this case is to exclude the type from the assembly test like so:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
AssemblyTester tester = new AssemblyTester(&amp;quot;MyType, MyAssembly&amp;quot;);
tester.Exclusions.AddType(typeof(TypeWithUntestableProperty));
tester.TestAssembly(true, true);
&lt;/pre&gt; &lt;br /&gt; Now, add another test to target that class using the PropertyTester directly:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PropertyTester tester = new PropertyTester(new TypeWithUntestableProperty));
tester.TestProperties();
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>molmorg</author><pubDate>Wed, 09 Jan 2008 16:19:11 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: AssemblyTester 20080109041911P</guid></item><item><title>UPDATED WIKI: AssemblyTester</title><link>http://www.codeplex.com/classtester/Wiki/View.aspx?title=AssemblyTester&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
The AssemblyTester
&lt;/h1&gt; &lt;br /&gt;The AssemblyTester uses the &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=PropertyTester&amp;amp;referringTitle=AssemblyTester"&gt;PropertyTester&lt;/a&gt; and &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=ConstructorTester&amp;amp;referringTitle=AssemblyTester"&gt;ConstructorTester&lt;/a&gt; and can remove much of the coding previously required to use them by applying these tests to all the types in an assembly, subject to exclusions that you can specify.&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
How it works
&lt;/h3&gt; &lt;br /&gt;To test an assembly simply create an instance of the AssemblyTester passing it the name of the Assembly to test.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
AssemblyTester tester = new AssemblyTester(&amp;quot;TheJoyOfCode.QualityTools&amp;quot;);
&lt;/pre&gt; &lt;br /&gt;Now you can call the AssemblyTesters TestAssembly method which looks like this:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     public void TestAssembly(bool testProperties, bool testConstructors)
&lt;/pre&gt; &lt;br /&gt;The testProperties and testConstructors parameters should be fairly self explanatory!&lt;br /&gt; &lt;br /&gt;The example below aims to test both constructors and properties in the &amp;quot;TheJoyOfCode.QualityTools.Tests.DummyProject&amp;quot; assembly.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     AssemblyTester tester = new AssemblyTester(&amp;quot;ExampleAssembly&amp;quot;);
     tester.TestAssembly(true, true);
&lt;/pre&gt; &lt;br /&gt;The AssemblyTester will throw an exception with a detailed description of errors encountered when testing an assembly. Here's an example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
AssemblyTesterTest.AssemblyTester_PassWithExclusions : FailedTheJoyOfCode.QualityTools.AssemblyTestException: 
Testing the assembly TheJoyOfCode.QualityTools.Tests.DummyProject produced the following errors:
------------
The get value of the 'Dummy4' property on the type 'TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties' 
did not equal the set value (in: '', out: 'fe6faacc-3ea8-45a0-8c5c-dc2e0021065b')
 [TestProperties,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties]
 
The value of the 'Dummy1' property did not equal the value set with the 'dummy1' 
constructor parameter (in: 'cf04ca44-73dc-4147-bb3e-2a1a0d2c52b3', out: '819e635d-4dc6-4e6c-b141-75f0212cb242')
 [TestConstructors,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectConstructors]
 
The type TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1 is an open 
Generic Definition (e.g. Class&amp;lt;T&amp;gt;. Only closed generic types Class&amp;lt;int&amp;gt; are currently supported.
 [TestConstructors,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1[T]]
 
Cannot create an instance of TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1[T] 
because Type.ContainsGenericParameters is true. 
[TestProperties,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.GenericClass`1[T]]
&lt;/pre&gt; &lt;br /&gt;Not all types in an assembly qualify for automatic testing of constructors or properties. Looking at the errors produced above it is clear that the two first errors are should be fixed (A property which is not mapped correctly and a constructor which does not map correctly to the corresponding property). The last two errors indicates that the AssemblyTester can not test this particular type because it contains generic parameters.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Exclusions
&lt;/h2&gt; &lt;br /&gt;To still use the AssemblyTester on this module we can skip these last two issues. This can be done in two ways, specifying one or more types to exclude or specifying a namespace to exclude. &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Excluding a type
&lt;/h3&gt; &lt;br /&gt;The example excludes the class which is not qualified for automatic testing to the AssemblyTester.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     AssemblyTester tester = new AssemblyTester(&amp;quot;TheJoyOfCode.QualityTools.Tests.DummyProject&amp;quot;);
     tester.Exclusions.AddType(typeof(GenericClass&amp;lt;&amp;gt;));
     tester.TestAssembly(AssemblyTester.TestTarget.Properties | AssemblyTester.TestTarget.Constructors);
&lt;/pre&gt; &lt;br /&gt;When running the test again the AssemblyTester only produces the following errors.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
TheJoyOfCode.QualityTools.AssemblyTestException: Testing the assembly 
TheJoyOfCode.QualityTools.Tests.DummyProject produced the following errors:
------------
The get value of the 'Dummy4' property on the type 'TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties' 
did not equal the set value (in: '', out: '1e5101b5-e9e9-4d69-b13c-83863f70a7b6')
 [TestProperties,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectProperties]
 
The value of the 'Dummy1' property did not equal the value set with the 'dummy1' 
constructor parameter (in: '2bf2002e-b505-4413-a8f9-97036c40f720', out: '8a447a00-2f17-4d27-bb25-1fc66bf2c39d')
 [TestConstructors,Type:TheJoyOfCode.QualityTools.Tests.DummyProject.WithErrors.IncorrectConstructors]
&lt;/pre&gt; &lt;br /&gt;The errors above are errors which the AssemblyTester has been designed to detect; errors in mapping properties to fields and mapping values to constructors. So to make the test pass we need to fix those errors!&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Excluding a namespace
&lt;/h3&gt; &lt;br /&gt;The example below excludes all types in the namepace &amp;quot;ExampleAssembly.SomeNamespace&amp;quot; namespace &lt;b&gt;but does not exclude types in any sub namespaces.&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     tester.Exclusions.AddNamespace(&amp;quot;ExampleAssembly.SomeNamespace&amp;quot;, false);
&lt;/pre&gt; &lt;br /&gt;We could specify that all types within a numespace and sub-namespaces are excluded like so:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     tester.Exclusions.AddNamespace(&amp;quot;ExampleAssembly.SomeNamespace&amp;quot;, true);
&lt;/pre&gt; &lt;br /&gt;For example, this would also exclude any type in the &amp;quot;ExampleAssembly.SomeNamespace.SomeSubNamespace&amp;quot; too.&lt;br /&gt; &lt;br /&gt;You can have as many exclusions as you like and can combine type exclusions with namespace exclusions. Easy peasy.&lt;br /&gt; &lt;br /&gt;If you need to exclude a type from an assembly test because of one &lt;i&gt;funky&lt;/i&gt; property or constructor you can always target that type directly with the &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=PropertyTester&amp;amp;referringTitle=AssemblyTester"&gt;PropertyTester&lt;/a&gt; or &lt;a href="http://www.codeplex.com/classtester/Wiki/View.aspx?title=ConstructorTester&amp;amp;referringTitle=AssemblyTester"&gt;ConstructorTester&lt;/a&gt; and exclude the property/type specifically. Best of both worlds.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Adding your own exclusion rules
&lt;/h2&gt;It's easy to extend the exclusion policies available in the AssemblyTester by creating your own class that inherits from TestExclusion. Imagine you want to be able to exclude any class that starts with the letter 'S'. First we need a new &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
private class StartsWithSExclusion : TestExclusion
{
    public override bool IsExcluded(Type type)
    {
        return type.Name.StartsWith(&amp;quot;S&amp;quot;);
    }
}
&lt;/pre&gt; &lt;br /&gt;Now we just have to add that type to the Exclusions as follows:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
     tester.Exclusions.Add(new StartsWithSExclusion());
&lt;/pre&gt; &lt;br /&gt;... and any types whose name starts with an S won't be tested.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
FAQ
&lt;/h2&gt; &lt;br /&gt;&lt;b&gt;Q:&lt;/b&gt; It's nice that I can exclude whole types and namespaces using the AssemblyTester but why can't I specify a single property on a type that should be excluded.&lt;br /&gt;&lt;b&gt;A:&lt;/b&gt; This feature is deliberately not included to date. The practice in this case is to exclude the type from the assembly test like so:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
AssemblyTester tester = new AssemblyTester(&amp;quot;MyType, MyAssembly&amp;quot;);
tester.Exclusions.AddType(typeof(TypeWithUntestableProperty));
tester.TestAssembly(true, true);
&lt;/pre&gt; &lt;br /&gt;And add another test to target that class using the PropertyTester&lt;br /&gt; &lt;br /&gt;/// TODO + unfinished + &lt;br /&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>molmorg</author><pubDate>Wed, 09 Jan 2008 15:35:04 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: AssemblyTester 20080109033504P</guid></item><item><title>Source code checked in</title><link>http://www.codeplex.com/classtester/SourceControl/ListDownloadableCommits.aspx</link><description>Fixed documentation references.</description><author>Bruusi</author><pubDate>Wed, 09 Jan 2008 12:28:28 GMT</pubDate><guid isPermaLink="false">Source code checked in 20080109122828P</guid></item><item><title>NEW POST: Problem with DateTime property</title><link>http://www.codeplex.com/classtester/Thread/View.aspx?ThreadId=20066</link><description>&lt;div class="wikidoc"&gt;
I figured it out: the miliseconds are not preserved in my class. I guess I'll simply ignore this property.&lt;br /&gt;
&lt;/div&gt;</description><author>Jericho</author><pubDate>Mon, 07 Jan 2008 21:21:12 GMT</pubDate><guid isPermaLink="false">NEW POST: Problem with DateTime property 20080107092112P</guid></item><item><title>Source code checked in</title><link>http://www.codeplex.com/classtester/SourceControl/ListDownloadableCommits.aspx</link><description></description><author>molmorg</author><pubDate>Mon, 07 Jan 2008 17:57:18 GMT</pubDate><guid isPermaLink="false">Source code checked in 20080107055718P</guid></item><item><title>Source code checked in</title><link>http://www.codeplex.com/classtester/SourceControl/ListDownloadableCommits.aspx</link><description>Added pluggable TypeFactory &amp;#40;implements ITypeFactory&amp;#41; and fixed a bug in one of the error messages &amp;#40;in and out reversed&amp;#41;. Added test using RhinoMocks to verify that GetSet, Get and Set only properties.</description><author>molmorg</author><pubDate>Mon, 07 Jan 2008 17:43:19 GMT</pubDate><guid isPermaLink="false">Source code checked in 20080107054319P</guid></item><item><title>CREATED ISSUE: Compare two provided objects instead of comparing randomly generated value</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3129</link><description>Comparing randomly genrated values is great for detecting bugs where a public property uses the wrong private field. Another test that would also be very useful is to compare all the properties of two provided objects. What I&amp;#39;m envisioning is something like this &amp;#40;this is only psendo-code&amp;#41;&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;TestMethod&amp;#93;&lt;br /&gt;public void TestPerson&amp;#40;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;    Person p1 &amp;#61; new Person&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;    p1.Name &amp;#61; &amp;#34;Bob Smith&amp;#34;&amp;#59;&lt;br /&gt;    string personId &amp;#61; MyDAL.Save&amp;#40;p1&amp;#41;&amp;#59;&lt;br /&gt;    Person p2 &amp;#61; MyDAL.Fetch&amp;#40;personId&amp;#41;&amp;#59;&lt;br /&gt;    PropertyTester tester &amp;#61; new PropertyTester&amp;#40;p1, p2&amp;#41;&amp;#59;&lt;br /&gt;    tester.TestProperties&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;</description><author>Jericho</author><pubDate>Mon, 07 Jan 2008 16:14:48 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Compare two provided objects instead of comparing randomly generated value 20080107041448P</guid></item><item><title>CREATED ISSUE: Exclude class property when testing Assembly</title><link>http://www.codeplex.com/classtester/WorkItem/View.aspx?WorkItemId=3127</link><description>The Assembly tester currently allows to exclude an entire namespace or an entire class but it would be great to also be able to exclude a specific property of a specific class. For example&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;code&amp;#93;&lt;br /&gt;&amp;#91;Test&amp;#93;&lt;br /&gt;public void AssemblyTester_PassWithExclusions&amp;#40;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;    AssemblyTester tester &amp;#61; new AssemblyTester&amp;#40;&amp;#34;ExampleAssembly&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;    tester.Exclusions.AddProperty&amp;#40;&amp;#34;ExampleAssembly.SomeNamespace.SomeClass&amp;#34;, &amp;#34;PropertyName&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;    tester.TestAssembly&amp;#40;true, true&amp;#41;&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;&amp;#91;&amp;#47;code&amp;#93;&lt;br /&gt;</description><author>Jericho</author><pubDate>Mon, 07 Jan 2008 16:05:18 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Exclude class property when testing Assembly 20080107040518P</guid></item><item><title>NEW POST: Problem with DateTime property</title><link>http://www.codeplex.com/classtester/Thread/View.aspx?ThreadId=20066</link><description>&lt;div class="wikidoc"&gt;
When testing one of my classes I am getting an error regarding a DateTime property but the get value and the set value match:&lt;br /&gt; &lt;br /&gt;Test method WebExApiTest.WebExXmlTypePropertiesTest.TestEventSchedule threw exception:  TheJoyOfCode.QualityTools.PropertyTestException: The get value of the 'StartDate' property on the type 'WebExApi.EventSchedule' did not equal the set value (in: '1/1/0001 12:02:34 AM', out: '1/1/0001 12:02:34 AM').&lt;br /&gt; &lt;br /&gt;Can anybody examplain why I'm getting an error even though the values appear to be the same?&lt;br /&gt;
&lt;/div&gt;</description><author>Jericho</author><pubDate>Mon, 07 Jan 2008 15:47:47 GMT</pubDate><guid isPermaLink="false">NEW POST: Problem with DateTime property 20080107034747P</guid></item></channel></rss>