trackabout/speceasy — pull request #18 by bpruitt-goddard (2013-10-06 23:29:31+00:00)
Title: Decouple Rhino Mocks

This removes the dependency in the core SpecEasy code from RhinoMocks and provides an easy way to extend SpecEasy to use a different mocking framework as discussed in issue #17.

Made some major architectural changes to project structure:
* `SpecEasy` - references `Rhino.Mocks`, `SpecEasy.Core`, and `SpecEasy.MockAdapters.RhinoMocks` to provide functionality "out of the box". Performs the wireup of RhinoMock implementation of `IMockingFramework`.
* `SpecEasy.Core` - has the core `Spec` class and its associated helpers. Also has `IMockingFramework` for providing the template for mocking specs.
* `SpecEasy.Core.Specs` - has any tests that are core only. For now this just means the `DatabaseIntegrationSpec`, but will include any tests that can be run with the base `Spec` class alone.
* `SpecEasy.MockAdapters.RhinoMocks` - includes `MockingFramework` that provides the RhinoMock implementation of the `IMockingFramework` mocking template.
* `SpecEasy.Specs` - references `Rhino.Mocks`, `SpecEasy`, and `SpecEasy.Core` to allow for testing SpecEasy with the addition of a mocking framework.

Template classes for providing mocking
* `IMockingFramework` - Provides the base methods used in all mocking frameworks including `GenerateMock`, `AssertWasCalled`, etc.
* `GenericSpecBase` - Provides the base `Spec` class with minimal mocking ability. Wires up `IMockingFramework` by calling the abstract `GetConcreteMockingFramework` method inside of `BeforeEachExample`.

In order to get RhinoMocks wired up as the mocking framework, only a few things had to be done.
1. Create a concrete implementation of `IMockingFramework`. This was done in SpecEasy.MockAdapters.RhinoMocks.MockingFramework.
2. Subclass `GnericSpecBase` to use the class from 1. This is done in SpecEasy.GenericSpec in the `GetConcreteMockingFramework` method.

RhinoMocks also extended the mocking framework to provide the additional `AssertWasCalled` method overrides with [`IMethodOptions`](https://github.com/ayende/rhino-mocks/blob/master/Rhino.Mocks/RhinoMocksExtensions.cs#L233).
1. Extend the `IMockingFramework` in SpecEasy.MockingAdapters.RhinoMocks.IRhinoMockingFramework.
2. Expose additional features by extending `GenericSpecBase`. This was done in SpecEasy.GenericSpec.

#### Implementation Questions
* I'm not sure if we should move the generic mocking code out of SpecEasy.Core into a general SpecEasy.MockAdapters.Core or similar project. I felt that at this point that would be a little overkill.
* Providing base mocking tests. Currently all of the mocking tests reside in the SpecEasy.Specs project. Should these be moved to a base project so we can run the same set of tests for any mocking implementation? I'm thinking of addressing this when/if we build out a second mocking adapter.