Created
May 16, 2011 15:14
-
-
Save bartelink/974621 to your computer and use it in GitHub Desktop.
AutoFixture Frozen extension relying on Injected Fixture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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