public void When_Order_Amount_Is_Positive_Then_Return_OrderAmountNonZero_Object() { var orderAmountNonZero = new OrderAmountNonZero(); orderAmountFactoryMock.Setup(x => x.GetOrderAmount(230)).Returns(orderAmountNonZero); var orderAmountObj = orderAmountFactoryMock.Object.GetOrderAmount(230); Assert.That(orderAmountObj.GetType().Equals(typeof(OrderAmountNonZero))); orderAmountFactoryMock.Verify(x => x.GetOrderAmount(230), Times.Once); }
public void When_Order_Amount_Is_Positive_Then_Return_Amount_Validation_Flag_Is_True() { var orderAmountNonZero = new OrderAmountNonZero(); orderAmountFactoryMock.Setup(x => x.GetOrderAmount(120)).Returns(orderAmountNonZero); orderAmountValidatorMock.Setup(x => x.ValidateOrderAmount(orderAmountNonZero)).Returns(false); var orderAmountObj = orderAmountFactoryMock.Object.GetOrderAmount(120); var validationFlag = orderAmountValidatorMock.Object.ValidateOrderAmount(orderAmountObj); Assert.That(orderAmountObj.GetType().Equals(typeof(OrderAmountNonZero))); Assert.That(validationFlag, Is.False); orderAmountFactoryMock.Verify(x => x.GetOrderAmount(120), Times.Once); orderAmountValidatorMock.Verify(x => x.ValidateOrderAmount(orderAmountNonZero), Times.Once); }