Example #1
0
        public async Task AddDiscount_IsSuccess()
        {
            var discount = new DiscountDTO()
            {
                ProductSKU = "TST_A01",
                Quantity   = 3,
                Price      = 2
            };

            var result = await controller.PostAsync(discount);

            Assert.IsInstanceOfType(result, typeof(CreatedNegotiatedContentResult <DiscountDTO>));

            var response = result as CreatedNegotiatedContentResult <DiscountDTO>;

            Assert.IsNotNull(response.Content);
            Assert.IsNotNull(response.Content.Id);
            Assert.AreEqual(discount.ProductSKU, response.Content.ProductSKU);
            Assert.AreEqual(discount.Quantity, response.Content.Quantity);
            Assert.AreEqual(discount.Price, response.Content.Price);
        }