예제 #1
0
        public void TestExecuteShouldPrintInvoice()
        {
            _command.Execute(InvoiceId);

            _mocker.GetMock <IInvoiceWriter>()
            .Verify(p => p.Print(_invoice),
                    Times.Once);
        }
        public void TestExecuteShouldThrowExceptionIfUserIsNotAdmin()
        {
            _mocker.GetMock <ISecurity>()
            .Setup(p => p.IsAdmin())
            .Returns(false);

            Assert.That(() => _command.Execute(InvoiceId),
                        Throws.TypeOf <UserNotAuthorizedException>());
        }