public void Test_The_Return_Type_to_be_Ok_result_of_Get_Method_when_list_is_returned()
        {
            //Arranges
            List <HrViewModel> requestList = new List <HrViewModel>();

            requestList.Add(new HrViewModel {
                RequestId = 1, EmployeeCode = "12345678", SupervisorCode = "12349867", Newpacode = "noida", Newpsacode = "h7"
            });
            requestList.Add(new HrViewModel {
                RequestId = 2, EmployeeCode = "12345679", SupervisorCode = "12349867", Newpacode = "noida", Newpsacode = "h7"
            });
            var mockService = new Mock <IHRService>();

            mockService.Setup(m => m.GetAllRequest(It.IsAny <string>())).Returns(requestList);
            HRController obj = new HRController(mockService.Object);

            // Act
            IActionResult action1 = obj.Get("00059644");

            action1 = (OkObjectResult)action1;

            // Assert
            Assert.IsType(typeof(OkObjectResult), action1);
            Assert.Equal(requestList, (action1 as OkObjectResult).Value);
        }
        public void Test_The_Return_Type_to_be_Not_Found_of_Get_Method_if_no_object_is_returned_from_service()
        {
            //Arrange
            List <HrViewModel> requestList = new List <HrViewModel>();
            var mockService = new Mock <IHRService>();                                         //mocking the service

            mockService.Setup(m => m.GetAllRequest(It.IsAny <string>())).Returns(requestList); //setting up the response for the mocked service
            HRController obj = new HRController(mockService.Object);

            // Act
            IActionResult action1 = obj.Get("00059644");

            action1 = (NotFoundObjectResult)action1;

            // Assert
            Assert.IsType(typeof(NotFoundObjectResult), action1);
        }
        public void Test_The_Return_Type_to_be_StatusCode102_of_Get_Method_When_Timeout_exception_is_thrown()
        {
            //Arrange
            List <HrViewModel> requestList = new List <HrViewModel>();
            var mockService = new Mock <IHRService>();

            mockService.Setup(m => m.GetAllRequest(It.IsAny <string>())).Throws <TimeoutException>();
            HRController obj = new HRController(mockService.Object);

            // Act
            IActionResult action1 = obj.Get("00059644");

            action1 = (StatusCodeResult)action1;

            // Assert
            Assert.IsType(typeof(StatusCodeResult), action1);
            Assert.Equal(102, (action1 as StatusCodeResult).StatusCode);
        }