public void Test_The_Return_Type_to_be_Ok_result_of_GetDiscrepantRequest_Method_when_list_is_returned()
        {
            //Arranges
            List <DiscrepancyReport> requestList = new List <DiscrepancyReport>();

            requestList.Add(new DiscrepancyReport {
                RequestId = 1, EmployeeCode = "12345678", EmployeeName = "Rajiv", RequestPa = "0000123:Greater Noida"
            });
            requestList.Add(new DiscrepancyReport {
                RequestId = 2, EmployeeCode = "12345679", EmployeeName = "Rajeev", RequestPa = "0000123:Greater Noida"
            });
            var mockService = new Mock <IHRService>();

            mockService.Setup(m => m.GetAllDiscrepantRecordsList()).Returns(requestList);
            HRController obj = new HRController(mockService.Object);

            // Act
            IActionResult action1 = obj.GetDiscrepantRequest();

            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_GetDiscrepantRequest_Method_if_no_object_is_returned_from_service()
        {
            //Arrange
            List <DiscrepancyReport> requestList = new List <DiscrepancyReport>();
            var mockService = new Mock <IHRService>();

            mockService.Setup(m => m.GetAllDiscrepantRecordsList()).Returns(requestList);
            HRController obj = new HRController(mockService.Object);

            // Act
            IActionResult action1 = obj.GetDiscrepantRequest();

            action1 = (NotFoundObjectResult)action1;

            // Assert
            Assert.IsType(typeof(NotFoundObjectResult), action1);
        }
        public void Test_The_Return_Type_to_be_StatusCode102_of_GetDiscrepantRequest_Method_When_Timeout_exception_is_thrown()
        {
            //Arrange

            var mockService = new Mock <IHRService>();

            mockService.Setup(m => m.GetAllDiscrepantRecordsList()).Throws <TimeoutException>();
            HRController obj = new HRController(mockService.Object);

            // Act
            IActionResult action1 = obj.GetDiscrepantRequest();

            action1 = (StatusCodeResult)action1;

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