public void SetUp() { _invoice = new Invoice() { Id = InvoiceId, Total = Total }; _mockDatabase = new Mock <IDatabase>(); _mockPrinter = new Mock <IPrinter>(); _mockDateTime = new Mock <IDateTimeWrapper>(); _mockDatabase .Setup(p => p.GetInvoice(InvoiceId)) .Returns(_invoice); _mockDateTime .Setup(p => p.GetNow()) .Returns(Date); _command = new PrintInvoiceCommand( _mockDatabase.Object, _mockPrinter.Object, _mockDateTime.Object); }
public void SetUp() { _invoice = new Invoice() { Id = InvoiceId, Total = Total }; _mocker = new AutoMoqer(); _mocker.GetMock <IDatabase>() .Setup(p => p.GetInvoice(InvoiceId)) .Returns(_invoice); _mocker.GetMock <IDateTimeWrapper>() .Setup(p => p.GetNow()) .Returns(Date); _command = _mocker.Create <PrintInvoiceCommand>(); }