{"__v":8,"_id":"5447ecac8d7af31a00dd4119","category":{"__v":1,"_id":"544854e74544c30800241f51","pages":["544853a8c1b42e08005b82b6","5447ecac8d7af31a00dd4119","5447ed6d0319802200fc0705","5447ef7a8d7af31a00dd4125","54485217c1b42e08005b82a6","5448536e4544c30800241f48","54485396c1b42e08005b82b2","547c7c5f78fd57080023c99c"],"project":"54471fc9e12a270800028adc","version":"54471fc9e12a270800028adf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-23T01:07:51.270Z","from_sync":false,"order":2,"slug":"basics","title":"Basics"},"is_link":false,"project":"54471fc9e12a270800028adc","user":"54471f91beb6320800da6f75","version":{"__v":10,"_id":"54471fc9e12a270800028adf","project":"54471fc9e12a270800028adc","createdAt":"2014-10-22T03:08:57.750Z","releaseDate":"2014-10-22T03:08:57.750Z","categories":["54471fc9e12a270800028ae0","5447b9e7b96a63140077d747","5447be130319802200fc0620","5447ed118d7af31a00dd411c","5447ed230319802200fc0702","5448524c4544c30800241f41","544854504544c30800241f4d","544854af4544c30800241f50","544854e74544c30800241f51","54485557c1b42e08005b82bf"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-22T17:43:08.236Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":0,"body":"SpecsFor is a library designed to make crafting tests for .NET code a breeze. It includes a base test fixture that automatically handles common testing concerns, packages to address common testing needs (such as mocking and fluent asserts), and helpers to easily overcome many testing hurdles. \n\nSpecsFor is built on top of five excellent open-source libraries, each of which solves various testing challenges.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"NUnit\"\n}\n[/block]\nAt its core, SpecsFor utilizes the [NUnit Testing Framework](http://nunit.org/).  NUnit is a mature library for creating automated tests using .NET.  Most build servers and productivity tools support it, and since SpecsFor is built on top of NUnit, that means most build servers and productivity tools also support SpecsFor.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Moq\"\n}\n[/block]\nSpecsFor includes the [Moq mocking framework](https://github.com/Moq/moq4). Mocking plays an important role in top-down development and test-driven development, and Moq allows you to easily configure mocks and verify interactions with them.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"StructureMap\"\n}\n[/block]\nSpecsFor uses [StructureMap's auto-mocking container](http://docs.structuremap.net/AutoMocker.htm) to create your [System Under Test (SUT)](doc:the-system-under-test-sut) for you automatically.  If your SUT requires any dependencies, StructureMap will create them for you, supplying mock objects if possible. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Should\"\n}\n[/block]\nOut of the box, NUnit provides assertions that read more like machine instructions rather than natural language.  [Should](https://github.com/erichexter/Should) provides assertions in the form of extension methods for most of the common things you might want to assert. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ExpectedObjects\"\n}\n[/block]\nFinally, SpecsFor includes the [ExpectedObjects library](https://github.com/derekgreer/expectedObjects).  By default in .NET, two references are only equal if they point to the exact same instance of a class.  You can change this behavior by overriding the base Object.Equals method, but doing this across all the objects you may want to compare is non-trivial.  ExpectedObjects overcomes this problem by allowing you to assert that two instances *look* like one another.  \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Special Sauce\"\n}\n[/block]\nSpecsFor is the special sauce that brings all these packages together into a unified, easy-to-use platform.  SpecsFor provides a base class, SpecsFor<T>, that automatically creates your System Under Test using StructureMap, automatically creates mocks using Moq and provides an easy way to retrieve them later, and provides numerous ways to write clean specs, including a [Convention System](doc:overview), [context classes](doc:intro-to-context-classes), and numerous additional helpers to make you more productive.","excerpt":"","slug":"specsfor-overview","type":"basic","title":"SpecsFor overview"}
SpecsFor is a library designed to make crafting tests for .NET code a breeze. It includes a base test fixture that automatically handles common testing concerns, packages to address common testing needs (such as mocking and fluent asserts), and helpers to easily overcome many testing hurdles. SpecsFor is built on top of five excellent open-source libraries, each of which solves various testing challenges. [block:api-header] { "type": "basic", "title": "NUnit" } [/block] At its core, SpecsFor utilizes the [NUnit Testing Framework](http://nunit.org/). NUnit is a mature library for creating automated tests using .NET. Most build servers and productivity tools support it, and since SpecsFor is built on top of NUnit, that means most build servers and productivity tools also support SpecsFor. [block:api-header] { "type": "basic", "title": "Moq" } [/block] SpecsFor includes the [Moq mocking framework](https://github.com/Moq/moq4). Mocking plays an important role in top-down development and test-driven development, and Moq allows you to easily configure mocks and verify interactions with them. [block:api-header] { "type": "basic", "title": "StructureMap" } [/block] SpecsFor uses [StructureMap's auto-mocking container](http://docs.structuremap.net/AutoMocker.htm) to create your [System Under Test (SUT)](doc:the-system-under-test-sut) for you automatically. If your SUT requires any dependencies, StructureMap will create them for you, supplying mock objects if possible. [block:api-header] { "type": "basic", "title": "Should" } [/block] Out of the box, NUnit provides assertions that read more like machine instructions rather than natural language. [Should](https://github.com/erichexter/Should) provides assertions in the form of extension methods for most of the common things you might want to assert. [block:api-header] { "type": "basic", "title": "ExpectedObjects" } [/block] Finally, SpecsFor includes the [ExpectedObjects library](https://github.com/derekgreer/expectedObjects). By default in .NET, two references are only equal if they point to the exact same instance of a class. You can change this behavior by overriding the base Object.Equals method, but doing this across all the objects you may want to compare is non-trivial. ExpectedObjects overcomes this problem by allowing you to assert that two instances *look* like one another. [block:api-header] { "type": "basic", "title": "The Special Sauce" } [/block] SpecsFor is the special sauce that brings all these packages together into a unified, easy-to-use platform. SpecsFor provides a base class, SpecsFor<T>, that automatically creates your System Under Test using StructureMap, automatically creates mocks using Moq and provides an easy way to retrieve them later, and provides numerous ways to write clean specs, including a [Convention System](doc:overview), [context classes](doc:intro-to-context-classes), and numerous additional helpers to make you more productive.