public IHttpActionResult GetEmployee(string empID) { IQueryable <EmployeeEntity> empData; empData = bal_object.GetEmployee(empID); if (empData != null) { return(Ok(empData)); } else if (empData.Count() == 0) { return(NotFound()); } return(InternalServerError()); }
public void Test_Get_Employee() { //Arrange List <EmployeeDetail> empData = new List <EmployeeDetail> { new EmployeeDetail() { Name = "Sanjay Kumar", EmployeeID = "M100", } }; mockEmployee.Setup(x => x.GetEmployee(It.IsAny <string>())).Returns(empData.AsQueryable()); //Act var data = employeeBAL.GetEmployee("M100"); //Assert foreach (var items in data) { Assert.AreEqual("M100", items.EmployeeID); } }