public void Given_A_Product_Is_Null_When_MakePayment_Is_Called_Then_Throws_ArgumentNullException() { //arrange var physicalRule = new PhysicalProductRule(_mockRepository.Object); var _businessRules = new List <IProductBusinessRule>(); _businessRules.Add(physicalRule); var product = _fixture.Create <Book>(); product.ProductType = ProductType.Book; var sut = new PaymentStrategy(_businessRules); // Act Action act = () => sut.ProcessPayment(product); //Assert act.Should().ThrowExactly <ArgumentNullException>(); }
public void Given_A_Product_Is_Ordered_When_Product_Exists_Then_ProcessPayment_Successfully() { //arrange var physicalRule = new PhysicalProductRule(_mockRepository.Object); _mockRepository.Setup(m => m.GeneratePackingSlip()).Returns(Task.CompletedTask); _mockRepository.Setup(m => m.GenerateCommision()).Returns(Task.CompletedTask); var _businessRules = new List <IProductBusinessRule>(); _businessRules.Add(physicalRule); var product = _fixture.Create <PhysicalProduct>(); var sut = new PaymentStrategy(_businessRules); // Act Action act = () => sut.ProcessPayment(product); //Assert act.Should().NotThrow(); }