public async Task GetUserDates_InValid_ThrowException() { //Arrange _userDatesService.Setup(cs => cs.GetUserMembershipDatesAsync(It.IsAny <string>())).ThrowsAsync(new InvalidOperationException()); ActiveMembershipController activeMembershipController = _activeMembershipController; //Act var result = await activeMembershipController.GetUserDates(null); //Assert Assert.IsInstanceOf <BadRequestObjectResult>(result); }
public async Task GetUserDates_Valid_ReturnsOK(string id) { //Arrange _userDatesService.Setup(cs => cs.GetUserMembershipDatesAsync(It.IsAny <string>())).ReturnsAsync(new UserMembershipDatesDTO()); ActiveMembershipController activeMembershipController = _activeMembershipController; //Act var result = await activeMembershipController.GetUserDates(id); //Assert Assert.IsInstanceOf <OkObjectResult>(result); Assert.NotNull(((OkObjectResult)result).Value); Assert.IsInstanceOf <UserMembershipDatesDTO>(((OkObjectResult)result).Value); }