public async Task ThrowNotFoundExceptionForIdNotExists() { // Arrange DeleteAccountTypeCommand command = new DeleteAccountTypeCommand() { Id = 100 }; DeleteAccountTypeCommandHandler handler = new DeleteAccountTypeCommandHandler(_Database); // Act await Assert.ThrowsAsync <NotFoundException> (() => handler.Handle(command, CancellationToken.None)); }
public async Task ThrowsValidationExceptionWhenDeleteingSystemType() { // Arrange DeleteAccountTypeCommand command = new DeleteAccountTypeCommand() { Id = 10 }; DeleteAccountTypeCommandHandler handler = new DeleteAccountTypeCommandHandler(_Database); // Act await Assert.ThrowsAsync <ValidationException> (() => handler.Handle(command, CancellationToken.None)); }
public async Task DeleteAccountTypeSuccessfuly() { // Arrange DeleteAccountTypeCommand command = new DeleteAccountTypeCommand() { Id = 6 }; DeleteAccountTypeCommandHandler handler = new DeleteAccountTypeCommandHandler(_Database); // Act var result = await handler.Handle(command, CancellationToken.None); // Assert Assert.Equal(result, Unit.Value); }