public void Initialize_HasDescription_OrderNumberIsAddedToDescription() { CreditCard creditCard = new CreditCard(); Mock<IPayExPayment> paymentMock = new Mock<IPayExPayment>(); paymentMock.SetupAllProperties(); creditCard.Payment = paymentMock.Object; creditCard.Payment.Description = "Order number: {0}"; creditCard.OrderGroupId = 1000; _orderNumberGenerator.Initialize(creditCard, null, null, null); Assert.AreEqual(creditCard.Payment.Description, "Order number: " + creditCard.Payment.OrderNumber); }
public void Initialize_HasNoOrderNumber_OrderNumberIsGenerated() { CreditCard creditCard = new CreditCard(); Mock<IPayExPayment> paymentMock = new Mock<IPayExPayment>(); paymentMock.SetupAllProperties(); _orderNumberGeneratorMock.Setup(x => x.Generate(It.IsAny<Cart>())).Returns("Ordernumber"); creditCard.Payment = paymentMock.Object; creditCard.OrderGroupId = 1000; _orderNumberGenerator.Initialize(creditCard, null, null, null); Assert.IsNotNullOrEmpty(creditCard.Payment.OrderNumber); }