public async Task UpdateAValidUser() { var userCommandMother = UserMother.GetValidUpdateUserCommand(); _repository.Setup(x => x.Update(It.IsAny <User>())).Verifiable(); var _handler = new UpdateUserCommandHandler(_repository.Object, _eventBus.Object); await _handler.Handle(userCommandMother); _repository.Verify(); }
public async Task DisableAValidUser() { var userCommandMother = UserMother.GetValidDisableUserStatusCommand(); _repository.Setup(x => x.DisableUser(It.IsAny <Guid>())).Verifiable(); var _handler = new ChangeUserStatusCommandHandler(_repository.Object, _eventBus.Object); await _handler.Handle(userCommandMother); _repository.Verify(); }
public void ThrownInvalidUserServiceException_IfUserStatusIsInvalid_WhenEnableAnUser (int value) { var userCommandMother = UserMother.CreateUserStatusCommand(value); _repository.Setup(x => x.DisableUser(It.IsAny <Guid>())).Verifiable(); var _handler = new ChangeUserStatusCommandHandler(_repository.Object, _eventBus.Object); Assert.ThrowsAsync <InvalidUserServiceException>( () => _handler.Handle(null) ); }