public async Task When_Purchase_Order_Process_Request_Should_Process_The_Purchase_Order() { var address = new Address("street", "city", "state", "country", "zipcode"); var purchasedItem = new List <PurchaseOrderItem>() { new PurchaseOrderItem( new CatalogItemOrdered(1, CatalogItemType.Subscription, "ProductName", "PictureUri"), 5.0M, 5) }; var purchaseOrder = new ApplicationCore.PurchaseOrder.Domain.PurchaseOrder(Guid.NewGuid(), 123, 12345, address, purchasedItem); await purchaseOrder.ProcessPurchaseOrder(); Assert.True(purchaseOrder.IsPurchaseOrderProcessed); }
public void NewPurchaseOrderCreatedEvent_Should_Raised_When_Purchase_Order_Created() { var address = new Address("street", "city", "state", "country", "zipcode"); var purchasedItem = new List <PurchaseOrderItem>() { new PurchaseOrderItem( new CatalogItemOrdered(1, CatalogItemType.Subscription, "ProductName", "PictureUri"), 5.0M, 5) }; var purchaseOrder = new ApplicationCore.PurchaseOrder.Domain.PurchaseOrder(Guid.NewGuid(), 123, 12345, address, purchasedItem); var eventObj = purchaseOrder.UnCommittedEvents.FirstOrDefault(); Assert.Equal("NewPurchaseOrderCreatedEvent", eventObj.GetType().Name); Assert.Single(purchaseOrder.UnCommittedEvents); }