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")); }
public async Task ExecuteAsync_WhenCalled_AssertToDomainWasCalledOnUpdateAccountCommand() { CommandHandler sut = CreateSut(); Mock <IUpdateAccountCommand> commandMock = CreateCommandMock(); await sut.ExecuteAsync(commandMock.Object); commandMock.Verify(m => m.ToDomain(It.Is <IAccountingRepository>(value => value == _accountingRepositoryMock.Object)), Times.Once); }
public async Task ExecuteAsync_WhenCalled_AssertUpdateAccountAsyncWasCalledOnAccountingRepository() { CommandHandler sut = CreateSut(); IAccount account = _fixture.BuildAccountMock().Object; IUpdateAccountCommand command = CreateCommand(account); await sut.ExecuteAsync(command); _accountingRepositoryMock.Verify(m => m.UpdateAccountAsync(It.Is <IAccount>(value => value == account)), Times.Once); }