public void ApplService_User_deveria_deletar_usuario() { //Arrange var user = ObjectMother.userDelete; _repository.Setup(x => x.Delete(user.Id)).Returns(true); //Action var userDeleteAction = _appService.Delete(user); //Assert userDeleteAction.Should().BeTrue(); _repository.Verify(x => x.Delete(user.Id), Times.Once()); _repository.VerifyNoOtherCalls(); }
public int Delete(int id) { try { return(_userAppService.Delete(id)); } catch (Exception ex) { _logger.Error(ex, String.Format("ERROR: User/Delete id: {0}", id)); throw; } }
public async Task Should_Delete_User() { //Arrange CreateTestUsers(); var user = await GetUserByUserNameOrNullAsync("artdent"); user.ShouldNotBe(null); //Act await UserAppService.Delete(new EntityDto <long>(user.Id)); //Assert user = await GetUserByUserNameOrNullAsync("artdent"); user.IsDeleted.ShouldBe(true); }