internal static Employee GetEmployee(TestContext testContext) { var employee = new Employee(); employee.Title = testContext.DataRow["Title"].ToString(); employee.FirstName = testContext.DataRow["FirstName"].ToString(); employee.LastName = testContext.DataRow["LastName"].ToString(); employee.Email = testContext.DataRow["Email"].ToString(); employee.Phone = testContext.DataRow["Phone"].ToString(); employee.JoiningDate = DateTime.Parse(testContext.DataRow["JoiningDate"].ToString()); return employee; }
public void GetEmployeeByIdTest() { // add remark to employee var employee = new Employee() { FirstName = "Jane", LastName = "Doe", Email = "*****@*****.**", JoiningDate = DateTime.UtcNow }; var client = new HttpClient(); var createdEmployee = client.UploadData<Employee, Employee>(EmployeeManagementServiceUrl + "employee", employee); Assert.IsNotNull(createdEmployee); Assert.IsTrue(string.IsNullOrWhiteSpace(createdEmployee.Id) == false); var getEmployee = client.GetData<Employee>(EmployeeServiceUrl + "employee/" + createdEmployee.Id); Assert.IsNotNull(getEmployee); Assert.IsTrue(string.IsNullOrWhiteSpace(getEmployee.Id) == false); Assert.IsTrue(createdEmployee.Id == getEmployee.Id); }
public void AddRemarkToEmployeeTest() { // add remark to employee var employee = new Employee() { FirstName = "Jane", LastName = "Doe", Email = "*****@*****.**", JoiningDate = DateTime.UtcNow }; var client = new HttpClient(); var createdEmployee = client.UploadData<Employee, Employee>(EmployeeManagementServiceUrl + "employee", employee); Assert.IsNotNull(createdEmployee); Assert.IsTrue(string.IsNullOrWhiteSpace(createdEmployee.Id) == false); var remark = new Remark() { Text = "Remark1" , CreateTimeStamp = DateTime.UtcNow}; var createdRemark = client.UploadData<Remark, Remark>(EmployeeManagementServiceUrl + "employee/"+ createdEmployee.Id + "/remark", remark); Assert.IsNotNull(createdRemark); Assert.IsTrue(createdRemark.CreateTimeStamp > DateTime.MinValue); }
public void CreateInvalidEmployeeTest() { var employee = new Employee(); var client = new HttpClient(); var createdEmployee = client.UploadData<Employee, Employee>(EmployeeManagementServiceUrl + "employee", employee); }