public void Can_delete_subcription() { var customer = new Account { Id = Guid.NewGuid() }; var package = new cr953_package { Id = Guid.NewGuid() } .Set(e => e.cr953_monthlyprice, 100); var packageSummary = new cr953_packagesummary { Id = Guid.NewGuid() } .Set(e => e.cr953_customerid, customer.ToEntityReference()) .Set(e => e.cr953_totalamount, 100); var target = new cr953_subscription { Id = Guid.NewGuid() } .Set(e => e.cr953_customerid, customer.ToEntityReference()) .Set(e => e.cr953_packageid, package.ToEntityReference()) .Set(e => e.cr953_qty, 1) .Set(e => e.cr953_total, 100); var test = new TestEvent <cr953_subscription>(target, customer, package, packageSummary); test.DeleteEventCommand <CalculatePackageSummariesOnSubscriptionChange>(target.ToEntityReference()); Assert.True(test.Db.Event.Updated.Any()); var updated = test.Db.Event.Updated[0].ToEntity <cr953_packagesummary>(); Assert.Equal(packageSummary.Id, updated.Id); Assert.Equal(customer.Id, updated.Get(e => e.cr953_customerid).Id); Assert.Equal(0, updated.GetValue(e => e.cr953_totalamount)); }
public void Can_execute_command_on_delete() { var order = new new_order(Guid.NewGuid()); var orderDetailSummary = new new_orderdetailsummary(Guid.NewGuid()); var orderDetail = new new_orderdetail(Guid.NewGuid()) .Set(e => e.new_orderid, order.ToEntityReference()) .Set(e => e.new_orderdetailsummaryid, orderDetailSummary.ToEntityReference()); var test = new TestEvent <new_orderdetail>(order, orderDetail, orderDetailSummary); test.DeleteEventCommand <DeleteOrderDetailSummary>(orderDetail.ToEntityReference()); Assert.Equal(orderDetailSummary.ToEntityReference(), test.Db.Event.Deleted[0]); }
public void Can_execute_command_on_delete() { var order = new Entity("new_order", Guid.NewGuid()); var orderDetailSummary = new Entity("new_orderdetailsummary", Guid.NewGuid()); var orderDetail = new Entity("new_orderdetail", Guid.NewGuid()) { ["new_orderid"] = order.ToEntityReference(), ["new_orderdetailsummaryid"] = orderDetailSummary.ToEntityReference() }; var test = new TestEvent(order, orderDetail, orderDetailSummary); test.DeleteEventCommand <DeleteOrderDetailSummary>(orderDetail.ToEntityReference()); Assert.Equal(orderDetailSummary.ToEntityReference(), test.Db.Event.Deleted[0]); }