Skip to content

Instantly share code, notes, and snippets.

@rasmuskl
Created December 16, 2011 16:02
Show Gist options
  • Select an option

  • Save rasmuskl/1486597 to your computer and use it in GitHub Desktop.

Select an option

Save rasmuskl/1486597 to your computer and use it in GitHub Desktop.
Autofixture question
public class TestClass
{
public void Test1()
{
var fixture = new Fixture();
// This doesn't let me pass 42?
sut.Freeze<int>("importantNumber");
var sut = fixture.CreateAnonymous<ToBeInstantiated>();
sut.Magic.ShouldBeTrue();
}
public class ToBeInstantiated
{
public class ToBeInstantiated(int someNumber, int importantNumber)
{
// Magic happens depending on value of importantNumber
Magic = importantNumber == 42;
}
public bool Magic { get; private set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment