public void Can_execute_plugin_on_create() { var order = new Entity("new_order") { Id = Guid.NewGuid() }; var target = new Entity("new_orderdetail") { Id = Guid.NewGuid(), ["new_orderid"] = order.ToEntityReference(), ["new_quantity"] = 2, ["new_priceperitem"] = new Money(1500) }; var test = new TestEvent(order); test.CreateEvent <Plugin>(target); var summaryRef = target.Get <EntityReference>("new_orderdetailsummaryid"); Assert.NotNull(summaryRef); var summary = test.Db.Event.Created[0]; Assert.Equal(3000m, summary.Get <Money>("new_totalprice").Value); }
public void Can_execute_command_on_create() { var order = new new_order(Guid.NewGuid()); var target = new new_orderdetail(Guid.NewGuid()) .Set(e => e.new_orderid, order.ToEntityReference()) .Set(e => e.new_quantity, 2) .Set(e => e.new_priceperitem, 1500); var test = new TestEvent(order); test.CreateEvent <Plugin>(target); var summaryRef = target.Get(e => e.new_orderdetailsummaryid); Assert.NotNull(summaryRef); var summary = test.Db.Event.Created[0].ToEntity <new_orderdetailsummary>(); Assert.Equal(3000m, summary.Get(e => e.new_totalprice).Value); }