public async Task Should_Create_PurchaseOrder()
        {
            // Arrange
            var customerGuid   = Guid.NewGuid();
            var validProductId = Resolve <PurchaseOrderServiceMockManager>().ValidProduct;

            // Act
            var purchaseOrder = await _appService.CreatePurchaseOrderAsync(new PurchaseOrderDto
            {
                CustomerId = customerGuid,
                Discount   = 5,
                Products   = new List <ProductDto>()
                {
                    new ProductDto(validProductId, 1)
                }
            });

            // Assert
            Assert.False(LocalNotification.HasNotification());
            Assert.NotEqual(Guid.Empty, purchaseOrder.Id);
            Assert.Equal(5, purchaseOrder.Discount);
            Assert.Equal(customerGuid, purchaseOrder.CustomerId);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Post([FromBody] PurchaseOrderDto purchaseOrder)
        {
            var response = await _appService.CreatePurchaseOrderAsync(purchaseOrder);

            return(CreateResponseOnPost(response, name));
        }