public void ArgumentExceptionAsyncTest() { IDiscountCalculatorAsync discountCalculator = CreateDiscountCalculator(); Action actnull = () => discountCalculator.CalculateDiscountAsync(null).Wait(); actnull.Should().Throw <ArgumentNullException>(); }
public void CalculateAsyncTest() { // Arrange IDiscountCalculatorAsync discountCalculator = CreateDiscountCalculator(); Order order = CreateOrderWith1Product("2019-10-18", 1000); // Act Func <Task <decimal> > act = () => discountCalculator.CalculateDiscountAsync(order); // Asserts act.Should() .CompleteWithin(500.Milliseconds()) .Which .Should() .Be(500); }