public async Task ChangeApproveStatus_ReturnsOkObjectResult() { //Arrange var memberId = GetClubId(); var clubId = GetClubId(); _mapper .Setup(m => m.Map <ClubMembersDTO, ClubMembersViewModel>(It.IsAny <ClubMembersDTO>())) .Returns(new ClubMembersViewModel()); _clubMembersService .Setup(x => x.ToggleIsApprovedInClubMembersAsync(memberId, clubId)) .ReturnsAsync(new ClubMembersDTO()); //Act var result = await _clubController.ChangeApproveStatus(clubId, memberId); var resultValue = (result as OkObjectResult).Value; //Assert _mapper.Verify(); _clubMembersService.Verify(); Assert.IsNotNull(result); Assert.IsInstanceOf <OkObjectResult>(result); Assert.IsNotNull(resultValue); Assert.IsInstanceOf <ClubMembersViewModel>(resultValue); }
public async Task ChangeApproveStatus_Valid_Test() { _ClubParticipantsService.Setup(c => c.ToggleApproveStatusAsync(It.IsAny <int>())) .ReturnsAsync(new ClubMembersDTO()); _logger.Setup(l => l.LogInformation(It.IsAny <string>())); ClubController Clubcon = CreateClubController; var result = await Clubcon.ChangeApproveStatus(GetFakeID()); Assert.NotNull(result); Assert.IsInstanceOf <OkObjectResult>(result); }