示例#1
0
        public void GetPdfFailsIdInvoiceIdIsNotValidInteger()
        {
            //Arrange
            var sut = new Facade{Session = SessionMock.Object};

            //Act
            sut.GetPdf("not an integer");
        }
示例#2
0
        public void GetPdfReturnsPdfFileContents()
        {
            //Arrange
            var expectedBytes = new byte[255];

            var invoiceMock = new Mock<IInvoice>();
            invoiceMock.Setup(invoice => invoice.GetPdf()).Returns(expectedBytes);

            var invoiceUtilMock = new Mock<IInvoiceUtil>();
            invoiceUtilMock.Setup(util => util.FindByNumber(5)).Returns(invoiceMock.Object);

            SessionMock.SetupGet(session => session.Invoice).Returns(invoiceUtilMock.Object);

            var sut = new Facade {Session = SessionMock.Object};

            //Act
            var actual = sut.GetPdf("5");

            //Assert
            Assert.AreEqual(expectedBytes, actual);
        }