Skip to content

Instantly share code, notes, and snippets.

View bartelink's full-sized avatar

Ruben Bartelink bartelink

View GitHub Profile
@bartelink
bartelink / Frozen.cs
Created May 16, 2011 15:14
AutoFixture Frozen extension relying on Injected Fixture
public class Frozen<T>
{
readonly T _value;
private Frozen( T t )
{
_value = t;
}
public Frozen( Fixture fixture )
@bartelink
bartelink / ThesisExample.cs
Created November 5, 2010 12:52
Demonstrates bitbucket.org/johannesrudolph/subspec/overview
1. uses a ContextFixture (which requires Disposal)
2. keeps all Context/ContextFixture+Do+Assert/Observation in a single Test Method at all costs -- lambdas get very yucky the minute you factor calls to any of these into test methods
3. The TheoryDataProvider junk at the end is also applicable to xUnit [Theory] stuff (and you use the same [ClassData] and friends as one uses for other xunit.net stuff and just removes some cruft from writing up test cases)
4. uses sut/result/exception standard names
5. This is a sample and has stuff that doesnt scale up that I wouldnt do. e.g. dont use Conditional Logic in tests with care - something as simple as a should succeed / should fail set of cases should generally be two separate Thesis methods
Go look in bitbucket - there's a good set of tests that serve as a better set of samples.
This snippet will self destruct when someone tells me that the acceptance tests and samples in Johannes' fork are clearer and more complete