public void ShouldGetOrder() { // arrange var cartLineModel = new NopOrdersService.ShoppingCartItemModel { Id = "1", ProductId = 41, Price = 1300, Quantity = 1, LineTotal = 1300 }; var orderModel = new OrderModel { CustomerId = 1, IsAnonymous = false, ShoppingItems = new ShoppingCartItemModel[0], CreatedDateTime = DateTime.Now, CardType = string.Empty, BillingName = string.Empty, BillingAddressId = 1, Addresses = new AddressModel[0], CustomerEmail = string.Empty, CustomerGuid = new Guid(), Id = 1, IsDeleted = false, Name = "order", OrderGuid = new Guid(), Shipments = new ShipmentModel[0], OrderItems = new[] { cartLineModel }, }; this.client.GetOrder(this.orderId, "NopShop").Returns(orderModel); // act this.processor.Process(this.args); // assert this.result.Order.CustomerId.Should().Be(this.customerId.ToString()); var cartLine = this.result.Order.Lines.Single(); cartLine.Product.ProductId.Should().Be("41"); cartLine.Product.Price.Amount.Should().Be(1300); cartLine.Quantity.Should().Be(1); }
public void ShouldCancelOrder() { // arrange var cartLineModel = new NopOrdersService.ShoppingCartItemModel { Id = "1", ProductId = 41, Price = 1300, Quantity = 1, LineTotal = 1300 }; var oldModel = new OrderModel { CustomerId = 1, IsAnonymous = false, ShoppingItems = new[] { cartLineModel }, CreatedDateTime = DateTime.Now, CardType = string.Empty, BillingName = string.Empty, BillingAddressId = 1, Addresses = new AddressModel[0], CustomerEmail = string.Empty, CustomerGuid = new Guid(), Id = 1, IsDeleted = false, Name = "order", OrderGuid = new Guid(), Shipments = new ShipmentModel[0] }; var newModel = new OrderModel { CustomerId = 1, IsAnonymous = false, ShoppingItems = new[] { cartLineModel }, CreatedDateTime = DateTime.Now, CardType = string.Empty, BillingName = string.Empty, BillingAddressId = 1, Addresses = new AddressModel[0], CustomerEmail = string.Empty, CustomerGuid = new Guid(), Id = 1, IsDeleted = false, Name = "order", OrderGuid = new Guid(), Shipments = new ShipmentModel[0], OrderItems = new ShoppingCartItemModel[0], Status = "Canceled" }; this.client.GetOrder(this.orderId, "NopShop").Returns(oldModel); this.client.CancelOrder(this.orderId, "NopShop").Returns(newModel); // act this.processor.Process(this.args); // assert this.client.Received(1).CancelOrder(this.orderId, "NopShop"); this.result.CancelledOrder.Status.Should().Be("Canceled"); }