<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>autofixture Wiki &amp; Documentation Rss Feed</title><link>http://autofixture.codeplex.com/Wiki/View.aspx?title=Home</link><description>autofixture Wiki Rss Description</description><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=33</link><description>&lt;div class="wikidoc"&gt;
&lt;div style="background-color:#fffbcc; padding-top:0px; padding-left:10px; padding-right:10px; padding-bottom:10px; border:#e6db55 1px solid"&gt;
&lt;h3&gt;This project has been migrated&lt;/h3&gt;
The AutoFixture project has &lt;a href="https://github.com/AutoFixture" target="_blank"&gt;
a new home&lt;/a&gt; on GitHub as of &lt;strong&gt;July 5, 2012&lt;/strong&gt;. Please note that this website will be kept around for historical reference while all new development is done over on
&lt;a href="https://github.com/AutoFixture/AutoFixture" target="_blank"&gt;the GitHub repo&lt;/a&gt;.&lt;/div&gt;
&lt;h2&gt;Project Description&lt;/h2&gt;
&lt;p&gt;Write maintainable unit tests, faster.&lt;br&gt;
&lt;br&gt;
AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;/p&gt;
&lt;h2&gt;Overview&lt;/h2&gt;
&lt;p&gt;(Jump straight to the &lt;a href="/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;
CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br&gt;
&lt;br&gt;
AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test's Fixture Setup phase. Among other features, it offers a generic
 implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br&gt;
&lt;br&gt;
When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence
 on the test, simply to make the code compile.&lt;br&gt;
&lt;br&gt;
AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;
Anonymous Variables&lt;/a&gt; for you. Here's a simple example:&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;[TestMethod]
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:green"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:blue"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:blue"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:blue"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:green"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:blue"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:green"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:blue"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#a31515"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:green"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br&gt;
This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number
&lt;em&gt;expectedNumber&lt;/em&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a 'nice', regular integer value, saving you the effort of explicitly coming up with one.&lt;br&gt;
&lt;br&gt;
The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;
SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br&gt;
&lt;br&gt;
Given the right combination of unit testing framework and extensions for AutoFixture, we can
&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;[Theory, AutoData]
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:blue"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:blue"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br&gt;
Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br&gt;
&lt;br&gt;
Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br&gt;
&lt;br&gt;
AutoFixture is available via NuGet (as &lt;em&gt;AutoFixture&lt;/em&gt;, &lt;em&gt;AutoFixture.AutoMoq&lt;/em&gt;,
&lt;em&gt;AutoFixture.AutoRhinoMocks&lt;/em&gt;, &lt;em&gt;AutoFixture.AutoFakeItEasy,&amp;nbsp;&lt;em&gt;AutoFixture.AutoNSubstitute&lt;/em&gt;&lt;/em&gt; and
&lt;em&gt;AutoFixture.Xunit&lt;/em&gt;).&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;p&gt;&lt;a href="/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br&gt;
&lt;a href="/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br&gt;
Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;
ploeh blog&lt;/a&gt;.&lt;br&gt;
&lt;a href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;br&gt;
&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br&gt;
&lt;a href="http://nikosbaxevanis.com/autofixture.xml"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;br&gt;
&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br&gt;
&lt;a href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Sun, 06 Jan 2013 23:00:18 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20130106110018P</guid></item><item><title>Updated Wiki: Documentation</title><link>http://autofixture.codeplex.com/documentation?version=16</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Overview&lt;/h1&gt;
&lt;p&gt;These pages provide the overall documentation for AutoFixture.&lt;/p&gt;
&lt;h2&gt;Architecture&lt;/h2&gt;
&lt;p&gt;AutoFixture is designed around a very general and extensible kernel, specialized by the Fixture class. The architecture and extensibility points are described on the
&lt;a href="/wikipage?title=Architecture&amp;referringTitle=Documentation"&gt;Architecture&lt;/a&gt; page.&lt;/p&gt;
&lt;h2&gt;Development&lt;/h2&gt;
&lt;p&gt;AutoFixture is currently being developed in C# on .NET 3.5 using Visual Studio 2010 with
&lt;a href="http://xunit.codeplex.com"&gt;xUnit.net&lt;/a&gt; as the unit testing framework. So far, all development has been done with TDD so there is a pretty high degree of code coverage, and it would be preferable to keep it that way.&lt;br&gt;
&lt;br&gt;
All binaries (such as xUnit.net) are included in the Mercurial repository under the \Lib folder. All additional binaries not part of .NET 3.5 must go there as well, so that it would be possible to pull down the repository and immediately be able to compile
 and run all tests.&lt;br&gt;
&lt;br&gt;
There are several different targeted solutions to be found under the \Src folder, but be aware that the final verification step before pushing to the repository is to successfully run all the unit tests in the BuildRelease.ps1 file.&lt;br&gt;
&lt;br&gt;
As part of the verification build, Visual Studio Code Analysis is executed in a configuration that treats warnings as errors. No CA warnings should be suppressed unless the documented conditions for suppression are satisfied. Otherwise, a documented agreement
 between at least two active developers of the project should be reached to allow a suppression of a non-suppressable warning.&lt;br&gt;
&lt;br&gt;
When developing for AutoFixture, please respect the coding style already present. Look around in the source code to get a feel for it. Also, please follow the
&lt;a href="http://tirania.org/blog/archive/2010/Dec-31.html"&gt;Open Source Contribution Etiquette&lt;/a&gt;. AutoFixture is a fairly typical open source project: if you want to contribute, start by
&lt;a href="http://blogs.msdn.com/b/codeplex/archive/2010/03/05/codeplex-mercurial-support-for-forks.aspx"&gt;
creating a fork and sending a pull request&lt;/a&gt; when you have something you wish to commit. When creating pull requests, please keep the Single Responsibility Principle in mind. A pull request that does a single thing very well is more likely to be accepted.&lt;br&gt;
&lt;br&gt;
If you consistently supply code of a high standard, you will eventually be granted Developer rights.&lt;br&gt;
&lt;br&gt;
AutoFixture is set for Continuous Integration on &lt;a href="http://teamcity.codebetter.com/project.html?projectId=project129&amp;tab=projectOverview"&gt;
http://teamcity.codebetter.com/project.html?projectId=project129&amp;amp;tab=projectOverview&lt;/a&gt;. The latest build (including strong names) can be downloaded from there, but Continuous Delivery is also enabled, which means that the latest build is also automatically
 published on CodePlex and NuGet.&lt;/p&gt;
&lt;h2&gt;Specifics&lt;/h2&gt;
&lt;p&gt;Detailed treatments of specific topics can typically be found on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;
ploeh blog&lt;/a&gt; as well:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ecampidoglio</author><pubDate>Thu, 05 Jul 2012 09:06:20 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20120705090620A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://autofixture.codeplex.com/documentation?version=15</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;a href="https://github.com/you"&gt;&lt;img src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub" style="top:0; right:0; border:0"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Overview&lt;/h1&gt;
&lt;p&gt;These pages provide the overall documentation for AutoFixture.&lt;/p&gt;
&lt;h2&gt;Architecture&lt;/h2&gt;
&lt;p&gt;AutoFixture is designed around a very general and extensible kernel, specialized by the Fixture class. The architecture and extensibility points are described on the
&lt;a href="/wikipage?title=Architecture&amp;referringTitle=Documentation"&gt;Architecture&lt;/a&gt; page.&lt;/p&gt;
&lt;h2&gt;Development&lt;/h2&gt;
&lt;p&gt;AutoFixture is currently being developed in C# on .NET 3.5 using Visual Studio 2010 with
&lt;a href="http://xunit.codeplex.com"&gt;xUnit.net&lt;/a&gt; as the unit testing framework. So far, all development has been done with TDD so there is a pretty high degree of code coverage, and it would be preferable to keep it that way.&lt;br&gt;
&lt;br&gt;
All binaries (such as xUnit.net) are included in the Mercurial repository under the \Lib folder. All additional binaries not part of .NET 3.5 must go there as well, so that it would be possible to pull down the repository and immediately be able to compile
 and run all tests.&lt;br&gt;
&lt;br&gt;
There are several different targeted solutions to be found under the \Src folder, but be aware that the final verification step before pushing to the repository is to successfully run all the unit tests in the BuildRelease.ps1 file.&lt;br&gt;
&lt;br&gt;
As part of the verification build, Visual Studio Code Analysis is executed in a configuration that treats warnings as errors. No CA warnings should be suppressed unless the documented conditions for suppression are satisfied. Otherwise, a documented agreement
 between at least two active developers of the project should be reached to allow a suppression of a non-suppressable warning.&lt;br&gt;
&lt;br&gt;
When developing for AutoFixture, please respect the coding style already present. Look around in the source code to get a feel for it. Also, please follow the
&lt;a href="http://tirania.org/blog/archive/2010/Dec-31.html"&gt;Open Source Contribution Etiquette&lt;/a&gt;. AutoFixture is a fairly typical open source project: if you want to contribute, start by
&lt;a href="http://blogs.msdn.com/b/codeplex/archive/2010/03/05/codeplex-mercurial-support-for-forks.aspx"&gt;
creating a fork and sending a pull request&lt;/a&gt; when you have something you wish to commit. When creating pull requests, please keep the Single Responsibility Principle in mind. A pull request that does a single thing very well is more likely to be accepted.&lt;br&gt;
&lt;br&gt;
If you consistently supply code of a high standard, you will eventually be granted Developer rights.&lt;br&gt;
&lt;br&gt;
AutoFixture is set for Continuous Integration on &lt;a href="http://teamcity.codebetter.com/project.html?projectId=project129&amp;tab=projectOverview"&gt;
http://teamcity.codebetter.com/project.html?projectId=project129&amp;amp;tab=projectOverview&lt;/a&gt;. The latest build (including strong names) can be downloaded from there, but Continuous Delivery is also enabled, which means that the latest build is also automatically
 published on CodePlex and NuGet.&lt;/p&gt;
&lt;h2&gt;Specifics&lt;/h2&gt;
&lt;p&gt;Detailed treatments of specific topics can typically be found on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;
ploeh blog&lt;/a&gt; as well:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ecampidoglio</author><pubDate>Thu, 05 Jul 2012 09:06:05 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20120705090605A</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=32</link><description>&lt;div class="wikidoc"&gt;
&lt;div style="background-color:#fffbcc; padding-top:0px; padding-left:10px; padding-right:10px; padding-bottom:10px; border:#e6db55 1px solid"&gt;
&lt;h3&gt;This project has been migrated&lt;/h3&gt;
The AutoFixture project has &lt;a href="https://github.com/AutoFixture" target="_blank"&gt;
a new home&lt;/a&gt; on GitHub as of &lt;strong&gt;July 5, 2012&lt;/strong&gt;. Please note that this website will be kept around for historical reference while all new development is done over on
&lt;a href="https://github.com/AutoFixture/AutoFixture" target="_blank"&gt;the GitHub repo&lt;/a&gt;.&lt;/div&gt;
&lt;h2&gt;Project Description&lt;/h2&gt;
&lt;p&gt;Write maintainable unit tests, faster.&lt;br&gt;
&lt;br&gt;
AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;/p&gt;
&lt;h2&gt;Overview&lt;/h2&gt;
&lt;p&gt;(Jump straight to the &lt;a href="/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;
CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br&gt;
&lt;br&gt;
AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test's Fixture Setup phase. Among other features, it offers a generic
 implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br&gt;
&lt;br&gt;
When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence
 on the test, simply to make the code compile.&lt;br&gt;
&lt;br&gt;
AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;
Anonymous Variables&lt;/a&gt; for you. Here's a simple example:&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;[TestMethod]
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:green"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:blue"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:blue"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:blue"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:green"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:blue"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:green"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:blue"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#a31515"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:green"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br&gt;
This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number
&lt;em&gt;expectedNumber&lt;/em&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a 'nice', regular integer value, saving you the effort of explicitly coming up with one.&lt;br&gt;
&lt;br&gt;
The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;
SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br&gt;
&lt;br&gt;
Given the right combination of unit testing framework and extensions for AutoFixture, we can
&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;[Theory, AutoData]
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:blue"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:blue"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br&gt;
Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br&gt;
&lt;br&gt;
Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br&gt;
&lt;br&gt;
AutoFixture is available via NuGet (as &lt;em&gt;AutoFixture&lt;/em&gt;, &lt;em&gt;AutoFixture.AutoMoq&lt;/em&gt;,
&lt;em&gt;AutoFixture.AutoRhinoMocks&lt;/em&gt;, &lt;em&gt;AutoFixture.AutoFakeItEasy&lt;/em&gt; and &lt;em&gt;
AutoFixture.Xunit&lt;/em&gt;).&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;p&gt;&lt;a href="/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br&gt;
&lt;a href="/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br&gt;
Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;
ploeh blog&lt;/a&gt;.&lt;br&gt;
&lt;a href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;br&gt;
&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br&gt;
&lt;a href="http://nikosbaxevanis.com/autofixture.xml"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;br&gt;
&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br&gt;
&lt;a href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Click here&lt;/a&gt; to view the RSS feed.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ecampidoglio</author><pubDate>Thu, 05 Jul 2012 08:59:20 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120705085920A</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=31</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;Anonymous Variables&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;ploeh blog&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Tue, 22 May 2012 07:18:17 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120522071817A</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=30</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;Anonymous Variables&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;ploeh blog&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 21 May 2012 20:55:30 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120521085530P</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=29</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;Anonymous Variables&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;ploeh blog&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 21 May 2012 20:54:30 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120521085430P</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=28</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;Anonymous Variables&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;ploeh blog&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 21 May 2012 16:39:46 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120521043946P</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=27</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html"&gt;Test Data Builder&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx"&gt;Anonymous Variables&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx"&gt;SUT Factory&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx"&gt;further reduce the above test to be even more declarative&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx"&gt;ploeh blog&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits"&gt;Nikos Baxevanis&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com"&gt;Enrico Campidoglio&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 21 May 2012 16:21:00 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120521042100P</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=26</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html" class="externalLink"&gt;Test Data Builder&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx" class="externalLink"&gt;Anonymous Variables&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx" class="externalLink"&gt;SUT Factory&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;further reduce the above test to be even more declarative&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx" class="externalLink"&gt;ploeh blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits" class="externalLink"&gt;Nikos Baxevanis&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/12/auto-mocking-with-fakeiteasy-and-autofixture.html"&gt;Auto-Mocking with FakeItEasy and AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;14 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://www.nikosbaxevanis.com/bonus-bits/autofixture/rss.xml"&gt;Bonus Bits&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/12/regularexpressionattribute-support-in-autofixture.html"&gt;RegularExpressionAttribute support in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;11 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://www.nikosbaxevanis.com/bonus-bits/autofixture/rss.xml"&gt;Bonus Bits&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/09/stringlengthattribute-support-in-autofixture.html"&gt;StringLengthAttribute support in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;18 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://www.nikosbaxevanis.com/bonus-bits/autofixture/rss.xml"&gt;Bonus Bits&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com" class="externalLink"&gt;Enrico Campidoglio&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Wed, 11 Jan 2012 13:15:33 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120111011533P</guid></item><item><title>Updated Wiki: Home</title><link>http://autofixture.codeplex.com/wikipage?version=25</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;Project Description&lt;/h2&gt;Write maintainable unit tests, faster.&lt;br /&gt;&lt;br /&gt;AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.&lt;br /&gt;
&lt;h2&gt;Overview&lt;/h2&gt;(Jump straight to the &lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt; if you just want to see some code samples right away.)&lt;br /&gt;&lt;br /&gt;AutoFixture is designed to make Test-Driven Development more productive and unit tests more refactoring-safe. It does so by removing the need for hand-coding anonymous variables as part of a test&amp;#39;s Fixture Setup phase. Among other features, it offers a generic implementation of the &lt;a href="http://www.natpryce.com/articles/000714.html" class="externalLink"&gt;Test Data Builder&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; pattern.&lt;br /&gt;&lt;br /&gt;When writing unit tests, you typically need to create some objects that represent the initial state of the test. Often, an API will force you to specify much more data than you really care about, so you frequently end up creating objects that has no influence on the test, simply to make the code compile.&lt;br /&gt;&lt;br /&gt;AutoFixture can help by creating such &lt;a href="http://blogs.msdn.com/ploeh/archive/2008/11/17/anonymous-variables.aspx" class="externalLink"&gt;Anonymous Variables&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for you. Here&amp;#39;s a simple example:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[TestMethod]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest()
{
    &lt;span style="color:Green;"&gt;// Fixture setup&lt;/span&gt;
    Fixture fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();

    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
    MyClass sut = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
    &lt;span style="color:Green;"&gt;// Exercise system&lt;/span&gt;
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    &lt;span style="color:Green;"&gt;// Verify outcome&lt;/span&gt;
    Assert.AreEqual&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;(expectedNumber, result, &lt;span style="color:#A31515;"&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;);
    &lt;span style="color:Green;"&gt;// Teardown&lt;/span&gt;
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This example illustrates the basic principle of AutoFixture: It can create values of virtually any type without the need for you to explicitly define which values should be used. The number &lt;i&gt;expectedNumber&lt;/i&gt; is created by a call to CreateAnonymous&amp;lt;T&amp;gt; - this will create a &amp;#39;nice&amp;#39;, regular integer value, saving you the effort of explicitly coming up with one.&lt;br /&gt;&lt;br /&gt;The example also illustrates how AutoFixture can be used as a &lt;a href="http://blog.ploeh.dk/2009/02/13/SUTFactory.aspx" class="externalLink"&gt;SUT Factory&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; that creates the actual System Under Test (the MyClass instance).&lt;br /&gt;&lt;br /&gt;Given the right combination of unit testing framework and extensions for AutoFixture, we can &lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;further reduce the above test to be even more declarative&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; IntroductoryTest(
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; expectedNumber, MyClass sut)
{
    &lt;span style="color:Blue;"&gt;int&lt;/span&gt; result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Notice how we can reduce unit tests to state only the relevant parts of the test. The rest (variables, Fixture object) is relegated to attributes and parameter values that are supplied automatically by AutoFixture. The test is now only two lines of code.&lt;br /&gt;&lt;br /&gt;Using AutoFixture is as easy as referencing the library and creating a new instance of the Fixture class!&lt;br /&gt;&lt;br /&gt;AutoFixture is available via NuGet (as &lt;i&gt;AutoFixture&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoMoq&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoRhinoMocks&lt;/i&gt;, &lt;i&gt;AutoFixture.AutoFakeItEasy&lt;/i&gt; and &lt;i&gt;AutoFixture.Xunit&lt;/i&gt;).&lt;br /&gt;
&lt;h2&gt;Resources&lt;/h2&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;referringTitle=Home"&gt;CheatSheet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autofixture.codeplex.com/wikipage?title=FAQ&amp;referringTitle=Home"&gt;FAQ&lt;/a&gt;&lt;br /&gt;Read more on &lt;a href="http://blog.ploeh.dk/CategoryView,category,AutoFixture.aspx" class="externalLink"&gt;ploeh blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2012/01/03/SOLIDIsAppendonly.aspx"&gt;SOLID is Append-only&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;03 January 2012&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/10/25/SOLIDConcrete.aspx"&gt;SOLID concrete&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;25 October 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://blog.ploeh.dk/2011/09/06/AutoFixtureGoesContinuousDeliveryWithSemanticVersioning.aspx"&gt;AutoFixture goes Continuous Delivery with Semantic Versioning&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://blog.ploeh.dk/SyndicationService.asmx/GetRssCategory?categoryName=AutoFixture"&gt;ploeh blog - AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;ploeh blog - AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits" class="externalLink"&gt;Nikos Baxevanis&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; also provides good posts about AutoFixture:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/12/auto-mocking-with-fakeiteasy-and-autofixture.html"&gt;Auto-Mocking with FakeItEasy and AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;14 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://www.nikosbaxevanis.com/bonus-bits/autofixture/rss.xml"&gt;Bonus Bits&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/12/regularexpressionattribute-support-in-autofixture.html"&gt;RegularExpressionAttribute support in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;11 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://www.nikosbaxevanis.com/bonus-bits/autofixture/rss.xml"&gt;Bonus Bits&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/09/stringlengthattribute-support-in-autofixture.html"&gt;StringLengthAttribute support in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;18 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://www.nikosbaxevanis.com/bonus-bits/autofixture/rss.xml"&gt;Bonus Bits&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Bonus Bits News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://megakemp.wordpress.com" class="externalLink"&gt;Enrico Campidoglio&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; also writes great AutoFixture blog posts:&lt;br /&gt;&lt;div class="rss"&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/zs8CUAcmx4s/"&gt;Keep your unit tests DRY with AutoFixture Customizations&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;15 December 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/dpD67WAg3RI/"&gt;Behavior changes in AutoFixture 2.2 – Anonymous numbers&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;06 September 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="entry"&gt;&lt;div class="title"&gt;&lt;a href="http://feedproxy.google.com/~r/thoughtology/autofixture/~3/UKai-KJmba8/"&gt;Anonymous delegates in AutoFixture&lt;/a&gt;&lt;/div&gt;&lt;div class="moreinfo"&gt;&lt;span class="date"&gt;01 August 2011&lt;/span&gt; &amp;nbsp;|&amp;nbsp; &lt;span class="source"&gt;From &lt;a target="_blank" href="http://feeds.feedburner.com/thoughtology/autofixture"&gt;Thoughtology » AutoFixture&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="accentbar"&gt;&lt;span class="left"&gt;&amp;nbsp;&lt;/span&gt;Thoughtology » AutoFixture News Feed&lt;span class="right"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Wed, 11 Jan 2012 13:13:57 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120111011357P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=24</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; primitiveValue, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;primitiveValue: int: 1&lt;br /&gt;text: string: &amp;quot;textf70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;text1: string: &amp;quot;foo&amp;quot;&lt;br /&gt;text2: string: &amp;quot;text2c1528179-fd1b-4f5a-a1f3-636e91f8799e&amp;quot;&lt;br /&gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;text1: string: &amp;quot;foo&amp;quot;&lt;br /&gt;text2: string: &amp;quot;bar&amp;quot;&lt;br /&gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 16:38:37 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102043837P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=23</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; primitiveValue, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;primitiveValue: int: 1&lt;br /&gt;text: string: &amp;quot;textf70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;text1: string: foo&lt;br /&gt;text2: string: &amp;quot;text2c1528179-fd1b-4f5a-a1f3-636e91f8799e&amp;quot;&lt;br /&gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;text1: string: foo&lt;br /&gt;text2: string: bar&lt;br /&gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 16:37:55 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102043755P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=22</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; primitiveValue, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;primitiveValue: int: 1&lt;br /&gt;text: string: &amp;quot;textf70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: string: &amp;quot;text2c1528179-fd1b-4f5a-a1f3-636e91f8799e&amp;quot;&lt;br /&gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: bar&lt;br /&gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 16:25:04 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102042504P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=21</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; primitiveValue, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;primitiveValue: int: 1&lt;br /&gt;text: string: &amp;quot;textf70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: an anonymous variable of type string&lt;br /&gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: bar&lt;br /&gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 16:21:28 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102042128P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=20</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; primitiveValue, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;primitiveValue: an anonymous variable of type int&lt;br /&gt;text: an anonymous variable of type string
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: an anonymous variable of type string&lt;br /&gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: bar&lt;br /&gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 14:38:48 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102023848P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=19</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory, AutoData]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; primitiveValue, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;primitiveValue: an anonymous variable of type int&lt;br /&gt;text: an anonymous variable of type string
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/10/08/AutoDataTheoriesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: an anonymous variable of type string&lt;br /&gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;text1: foo&lt;br /&gt;text2: bar&lt;br /&gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt; that includes an auto-mocking extension that uses Moq for Test Doubles.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 14:27:20 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102022720P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=18</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; text1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; text2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;-&amp;gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;--&amp;gt;text1: foo&lt;br /&gt;--&amp;gt;text2: an anonymous variable of type string&lt;br /&gt;--&amp;gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;-&amp;gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;--&amp;gt;text1: foo&lt;br /&gt;--&amp;gt;text2: bar&lt;br /&gt;--&amp;gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt; that includes an auto-mocking extension that uses Moq for Test Doubles.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 14:22:10 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102022210P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=17</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Inline AutoData Theories&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.Xunit&lt;/i&gt;.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
[Theory]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;)]
[InlineAutoData(&lt;span style="color:#A31515;"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span style="color:#A31515;"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;)]
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; Test(&lt;span style="color:Blue;"&gt;string&lt;/span&gt; s1, &lt;span style="color:Blue;"&gt;string&lt;/span&gt; s2, MyClass myClass)
{
}
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Uses the InlineData values for the the first method arguments, and then uses AutoData for the rest (when the InlineData values run out).&lt;br /&gt;-&amp;gt;&lt;i&gt;First test run&lt;/i&gt;:&lt;br /&gt;--&amp;gt;s1: foo&lt;br /&gt;--&amp;gt;s2: an anonymous variable of type string&lt;br /&gt;--&amp;gt;myClass: an anonymous variable of type MyClass&lt;br /&gt;-&amp;gt;&lt;i&gt;Second test run&lt;/i&gt;:&lt;br /&gt;--&amp;gt;s1: foo&lt;br /&gt;--&amp;gt;s2: bar&lt;br /&gt;--&amp;gt;myClass: an anonymous variable of type MyClass
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html" class="externalLink"&gt;http://www.nikosbaxevanis.com/bonus-bits/2011/08/combining-xunit-data-theories.html&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt; that includes an auto-mocking extension that uses Moq for Test Doubles.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 14:12:17 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102021217P</guid></item><item><title>Updated Wiki: CheatSheet</title><link>http://autofixture.codeplex.com/wikipage?title=CheatSheet&amp;version=16</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;AutoFixture Cheat Sheet&lt;/h1&gt;This page contains short code snippets that demonstrate AutoFixture features. All examples assume that a Fixture instance called &lt;i&gt;fixture&lt;/i&gt; has previously been created like this:&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; fixture = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; Fixture();
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Completely Anonymous String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousText = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;f5cdf6b1-a473-410f-95f3-f427f7abb0c7&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Seeded String&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousName = fixture.CreateAnonymous(&lt;span style="color:#A31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;Name30a35da1-d681-441b-9db3-77ff51728b58&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/02/CreatingStringsWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Anonymous Number&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;int&lt;/span&gt; anonymousNumber = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;int: 1, followed by 2, then by 3, etc.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/03/CreatingNumbersWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Complex Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; anonymousParent =
    fixture.CreateAnonymous&amp;lt;ComplexParent&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;ComplexParent:&lt;br /&gt;-&amp;gt;Child: ComplexChild&lt;br /&gt;--&amp;gt;Name: string: &amp;quot;namef70b67ff-05d3-4498-95c9-de74e1aa0c3c&amp;quot;&lt;br /&gt;--&amp;gt;Number: int: 1
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/03/24/HowAutoFixtureCreatesObjects.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Abstract Types&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Register&amp;lt;IMyInterface&amp;gt;(() =&amp;gt; 
    &lt;span style="color:Blue;"&gt;new&lt;/span&gt; FakeMyInterface());
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Every time the &lt;i&gt;fixture&lt;/i&gt; instance is asked to create an instance of IMyInterface, it will return a new instance of FakeMyInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/23/DealingWithTypesWithoutPublicConstructors.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Replaced Default Algorithm&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.TypeMappings[&lt;span style="color:Blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:Blue;"&gt;string&lt;/span&gt;)] = s =&amp;gt; &lt;span style="color:#A31515;"&gt;&amp;quot;fnaah&amp;quot;&lt;/span&gt;;
&lt;span style="color:Blue;"&gt;string&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;string: &amp;quot;fnaah&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/04/27/ReplacingAutoFixturesDefaultAlgorithms.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Strings&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; strings = fixture.CreateMany&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;string&amp;gt;:&lt;br /&gt;-&amp;gt; string: &amp;quot;ecc1cc75-cd7a-417f-b477-2913802440b4&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;fce70a7b-fae5-474f-8055-415ca46eac20&amp;quot;&lt;br /&gt;-&amp;gt; string: &amp;quot;79b45532-d66f-4abc-9311-77ba68dc9e3c&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Sequence of Custom Objects&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; myInstances = fixture.CreateMany&amp;lt;MyClass&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;IEnumerable&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextfda10499-e112-476b-924a-2c7b831227f2&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText6140d5f8-0639-4718-a82b-181d0410f9cf&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyText4a89c288-694a-4a19-a407-7348b70420cf&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Add to Collection&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; list = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; List&amp;lt;MyClass&amp;gt;();
fixture.AddManyTo(list);
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;List&amp;lt;MyClass&amp;gt;:&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextca86de74-e8df-46b1-bc15-63f763ce9e07&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextc45ff7b9-b30e-4246-b535-2eb06bc888c0&amp;quot;&lt;br /&gt;-&amp;gt; MyClass:&lt;br /&gt;--&amp;gt; MyText: string: &amp;quot;MyTextefadfab3-0992-4ecb-a3df-c6f1d5e61f12&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/05/11/AnonymousSequencesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Set Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.Build&amp;lt;MyClass&amp;gt;()
    .With(x =&amp;gt; x.MyText, &lt;span style="color:#A31515;"&gt;&amp;quot;Ploeh&amp;quot;&lt;/span&gt;)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyClass:&lt;br /&gt;-&amp;gt; MyText: string: &amp;quot;Ploeh&amp;quot;
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/06/01/SettingPropertyValuesWhileBuildingAnonymousVariablesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable AutoProperties&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; sut = fixture.Build&amp;lt;Vehicle&amp;gt;()
    .OmitAutoProperties()
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Vehicle:&lt;br /&gt;-&amp;gt; Wheels: int: 4&lt;br /&gt;The Wheels property will have the default value of 4, instead of having an anonymous value assigned via its setter
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/07/23/DisablingAutoPropertiesInAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Disable Property&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; person = fixture.Build&amp;lt;Person&amp;gt;()
    .Without(p =&amp;gt; p.Spouse)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;Person:&lt;br /&gt;-&amp;gt; BirthDay: DateTime: {18.08.2009 07:37:06}&lt;br /&gt;-&amp;gt; Name: String: &amp;quot;Name949c7c83-c77b-434f-a8fe-e0aa73f81fbe&amp;quot;&lt;br /&gt;-&amp;gt; Spouse: Person: null
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/17/OmittingOnlyCertainPropertiesWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Perform Action&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.Build&amp;lt;MyViewModel&amp;gt;()
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc)
    .CreateAnonymous();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/08/25/DoRedux.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/08/25/DoRedux.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Customize Type&lt;/h2&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mc = fixture.CreateAnonymous&amp;lt;MyClass&amp;gt;();
fixture.Customize&amp;lt;MyViewModel&amp;gt;(ob =&amp;gt; ob
    .Do(x =&amp;gt; x.AvailableItems.Add(mc))
    .With(x =&amp;gt; x.SelectedItem, mc));
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; mvm = fixture.CreateAnonymous&amp;lt;MyViewModel&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;MyViewModel:&lt;br /&gt;-&amp;gt; AvailableItems: ICollection&amp;lt;MyClass&amp;gt;&lt;br /&gt;--&amp;gt; MyClass (mc)&lt;br /&gt;-&amp;gt; SelectedItem: MyClass (mc)
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2009/09/22/CustomizingATypesBuilderWithAutoFixture.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Auto-Mocking with Moq&lt;/h2&gt;Add a reference to assembly &lt;i&gt;Ploeh.AutoFixture.AutoMoq&lt;/i&gt; that includes an auto-mocking extension that uses Moq for Test Doubles.&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
fixture.Customize(&lt;span style="color:Blue;"&gt;new&lt;/span&gt; AutoMoqCustomization());
&lt;span style="color:Blue;"&gt;var&lt;/span&gt; result = fixture.CreateAnonymous&amp;lt;IInterface&amp;gt;();
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Sample Result&lt;/h3&gt;A mocked instance of a type assignable from IInterface.
&lt;h3&gt;More Information&lt;/h3&gt;&lt;a href="http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx" class="externalLink"&gt;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>baxevanis</author><pubDate>Mon, 02 Jan 2012 13:30:10 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CheatSheet 20120102013010P</guid></item></channel></rss>