public void SubmitCreatesCurrentInvoiceWithDebtor() { //Arrange var debtorMock = new Mock<IDebtor>(); DebtorUtilMock.Setup(debtor => debtor.FindByNumber("20")).Returns(debtorMock.Object); var sut = new Facade { Session = SessionMock.Object }; //Act sut.Submit(new Invoice{CustomerId = "20"}); //Assert CurInvoiceUtilMock.Verify(currentInvoice => currentInvoice.Create(debtorMock.Object)); }
public void SubmitReturnsNumberOfBookedInvoice() { //Arrange const string expectedNumber = "13"; var invoiceMock = new Mock<IInvoice>(); invoiceMock.SetupGet(inv => inv.Number).Returns(13); var curInvoiceMock = new Mock<ICurrentInvoice>(); curInvoiceMock.Setup(curInvoice => curInvoice.Book()).Returns(invoiceMock.Object); CurInvoiceUtilMock.Setup(util => util.Create(It.IsAny<IDebtor>())).Returns(curInvoiceMock.Object); var sut = new Facade {Session = SessionMock.Object}; //Act var actual = sut.Submit(new Invoice()); //Assert Assert.AreEqual(expectedNumber, actual); }
public void SubmitCreatesCurrentInvoiceLines() { //Arrange var invoice = new Invoice(); invoice.AddLine(new InvoiceLine()); invoice.AddLine(new InvoiceLine()); invoice.AddLine(new InvoiceLine()); var sut = new Facade { Session = SessionMock.Object }; //Act sut.Submit(invoice); //Assert CurInvoiceLineUtilMock.Verify(currentInvoice => currentInvoice.Create(It.IsAny<ICurrentInvoice>()), Times.Exactly(3)); }