public async Task SearchUserController_GetByState_ValidAgeRange_ThrowsNoException()
        {
            // Arrange
            A.CallTo(() => fakeUserRepository.GetFilteredUsers(fakeSearchDetail)).Returns(userList);
            A.CallTo(() => fakeUserRepository.GetAllStates()).Returns(stateList);

            // Act
            searchUserController = new SearchUserController(fakeUserRepository, mapper, fakeSearchDetail, fakeMemoryCache, fakeLogger);
            actionResult         = await searchUserController.GetUsersByAgeRange(15, 99);

            okResult = actionResult as OkObjectResult;

            //Assert
            Assert.IsNotNull(okResult);
        }
        public async Task SearchUserController_GetByState_ValidAgeRange_ShouldHandleException()
        {
            // Arrange
            userList.Add(new User()
            {
                Age = 27, Email = "*****@*****.**", FirstName = "A3", LastName = "B3", ID = 3, StateCode = "NJ"
            });
            A.CallTo(() => fakeUserRepository.GetFilteredUsers(fakeSearchDetail)).Throws(new Exception("Error occured"));
            A.CallTo(() => fakeUserRepository.GetAllStates()).Returns(stateList);

            // Act
            searchUserController = new SearchUserController(fakeUserRepository, mapper, fakeSearchDetail, fakeMemoryCache, fakeLogger);
            actionResult         = await searchUserController.GetUsersByAgeRange(15, 99);

            okResult = actionResult as OkObjectResult;

            // Assert
            Assert.IsNull(okResult);
        }
        public async Task SearchUserController_GetByState_ValidAgeRange_ReturnsProperResults()
        {
            // Arrange
            userList.Add(new User()
            {
                Age = 25, Email = "*****@*****.**", FirstName = "A1", LastName = "B1", ID = 1, StateCode = "NJ"
            });
            A.CallTo(() => fakeUserRepository.GetFilteredUsers(fakeSearchDetail)).Returns(userList);
            A.CallTo(() => fakeUserRepository.GetAllStates()).Returns(stateList);

            // Act
            searchUserController = new SearchUserController(fakeUserRepository, mapper, fakeSearchDetail, fakeMemoryCache, fakeLogger);
            actionResult         = await searchUserController.GetUsersByAgeRange(15, 99);

            okResult = actionResult as OkObjectResult;
            List <UserViewModel> userVM = okResult.Value as List <UserViewModel>;

            // Assert
            Assert.IsNotNull(okResult);
            Assert.IsNotNull(userVM[0].Name);
            Assert.AreEqual(userVM[0].Name, "A1 B1");
        }