Skip to content

Instantly share code, notes, and snippets.

@bartelink
Created May 16, 2011 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bartelink/974621 to your computer and use it in GitHub Desktop.
Save bartelink/974621 to your computer and use it in GitHub Desktop.
AutoFixture Frozen extension relying on Injected Fixture
public class Frozen<T>
{
readonly T _value;
private Frozen( T t )
{
_value = t;
}
public Frozen( Fixture fixture )
: this( fixture.Freeze<T>() )
{
}
public static Frozen<T> Create( T t )
{
return new Frozen<T>( t );
}
public static implicit operator T( Frozen<T> frozen )
{
return frozen.Value;
}
public T Value
{
get { return _value; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment