Skip to content

Instantly share code, notes, and snippets.

@chrisnicola
Created February 6, 2011 00:11
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 chrisnicola/812952 to your computer and use it in GitHub Desktop.
Save chrisnicola/812952 to your computer and use it in GitHub Desktop.
public class when_updating_a_feature_for_a_product : domain_context<SetFeaturesForProduct, SetFeaturesForProductHandler>
{
static Product _product;
Establish context = () =>
{
_product = Given<Product>(History.product_created, History.product_feature_added);
ExpectedEvents = 1;
};
Because of = () => When(new SetFeaturesForProduct
{
ProductId = _product.EventSourceId,
Features = new Dictionary<string, object> { {"feature1", "updated feature value"} }
});
It should_have_updated_the_feature_value = () => Events.ShouldHave<ProductFeatureUpdated>(
x => x.Feature == "feature1",
x => x.Value == "updated feature value");
It should_do_nothing_else = () => Events.Count().ShouldEqual(ExpectedEvents);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment