Пример #1
0
        public void ExecuteAsync_WhenCommandIsNull_ThrowsArgumentNullException()
        {
            CommandHandler sut = CreateSut();

            ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.ExecuteAsync(null));

            Assert.That(result.ParamName, Is.EqualTo("command"));
        }
Пример #2
0
        public async Task ExecuteAsync_WhenCalled_AssertToDomainWasCalledOnUpdateContactAccountCommand()
        {
            CommandHandler sut = CreateSut();

            Mock <IUpdateContactAccountCommand> commandMock = CreateCommandMock();
            await sut.ExecuteAsync(commandMock.Object);

            commandMock.Verify(m => m.ToDomain(It.Is <IAccountingRepository>(value => value == _accountingRepositoryMock.Object)), Times.Once);
        }
Пример #3
0
        public async Task ExecuteAsync_WhenCalled_AssertUpdateBudgetAccountAsyncWasCalledOnAccountingRepository()
        {
            CommandHandler sut = CreateSut();

            IContactAccount contactAccount       = _fixture.BuildContactAccountMock().Object;
            IUpdateContactAccountCommand command = CreateCommand(contactAccount);
            await sut.ExecuteAsync(command);

            _accountingRepositoryMock.Verify(m => m.UpdateContactAccountAsync(It.Is <IContactAccount>(value => value == contactAccount)), Times.Once);
        }