Пример #1
0
        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);
        }
Пример #2
0
        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);
        }