Skip to content

Instantly share code, notes, and snippets.

@bsommardahl
Created December 6, 2012 21:00
Show Gist options
  • Save bsommardahl/4228338 to your computer and use it in GitHub Desktop.
Save bsommardahl/4228338 to your computer and use it in GitHub Desktop.
public class Car
{
public string Color { get; set; }
public string Model { get; set; }
public string Make { get; set; }
public string Year { get; set; }
}
public class given_an_object_property_changer_context
{
[Test]
public void it_should_change_the_object_properties_as_expected()
{
var myCar = new Car
{
Color = "Blue",
Make = "Chevy",
Model = "Cruze",
Year = "2011",
};
myCar.Change()
.With(x => x.Color = "Red")
.And(x => x.Year = "2012");
ExpectThatTheChangesWereMade(myCar);
}
void ExpectThatTheChangesWereMade(Car myCar)
{
Assert.AreEqual(myCar.Color, "Red");
Assert.AreEqual(myCar.Year, "2012");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment