AutoFixture/AutoFixture — pull request #294 by TeaDrivenDev (2014-06-15 09:57:50+00:00)
Title: Xunit2

Although/because xUnit 2 is still in beta, I'll put this up for review and discussion.

I created a copy of the `AutoFixture.Xunit.net` project (and the test project) and modified it to work with the current beta version of xUnit 2. It has exactly the same capabilities as the existing xUnit integration. The build process has been adjusted to allow for running xUnit 2 tests.

Although it cannot currently be merged, this is fully armed and operational with all tests passing, and has been verified on a real-world project that has used `AutoFixture.Xunit` for over a year (but does not use every feature).

### Points of note: ###

To my best knowledge, I have only made the minimum necessary changes to the original code. The purpose was solely to allow using the existing functionality of the xUnit integration with v2. The copy operation and the subsequent adjustments are in separate commits, so the changes can be verified.

As this has a dependency on a pre-release package, NuGet refuses to build a "stable" .nupkg. Therefore, the build script currently adds "-beta2" to the version of all created NuGet packages.

Because xUnit 2 uses .NET 4.5, both AutoFixture.Xunit.net2 and the test project had to be set to 4.5 as well.

As there is a NuGet package for the xUnit 2 runners, `Lib\XunitRunnerMSBuild` folder has been removed and the `xunit.runners` package added via NuGet. I have opted to leave out the version from the package directory name to allow for updating the runner without having to adjust the build script. The xUnit 2 runner is used to run both the existing v1 as well as the new v2 tests.

`ClassDataAttribute` has been removed from xUnit v2; to keep the few `AutoFixture.Xunit` tests that used it intact, the respective xUnit 1 class has been copied to the test project.

`InlineAutoDataAttribute` made use of `InlineDataAttribute` as the first element of a `CompositeDataAttribute`; this no longer works, as xUnit 2 completely changes the way values are retrieved from `InlineDataAttribute`. I have tried to change `CompositeDataAttribute` to follow the new pattern, but didn't find a way to accomplish that. **As a crutch**, I have introduced `ProxyInlineDataAttribute` as a copy of the original `InlineDataAttribute` from xUnit 1, so that I only needed to slightly modify `InlineAutoDataAttribute` to use it with xUnit 2. The type is public because a few tests need it, but has no public constructor. This solution currently works, but is certainly not very idiomatic in regard to the xUnit 2 API. Maybe @bradwilson can point to a more elegant way to handle this.