public async Task CreateDiscountReturnValidDiscount() { //Arrange var expectedCoupon = this.DesiredDiscount; _mockDiscountRepository.Setup(x => x.CreateDiscount(It.IsAny <Coupon>())).ReturnsAsync(true); //Act var result = await _sut.CreateDiscount(expectedCoupon); //Assert Assert.NotNull(result); var response = Assert.IsType <ActionResult <Coupon> >(result); var createResult = response.Result as CreatedAtRouteResult; Assert.Equal(201, createResult.StatusCode.Value); var returnedCoupon = Assert.IsType <Coupon>(createResult.Value); Assert.Equal(expectedCoupon.ProductName, returnedCoupon.ProductName); }