public void GetEmployeeWithNonExistingEmployeeId()
 {
     using (var getEmployeeService = new GetEmployeeServiceClient())
     {
         Employee emp        = null;
         int      employeeId = Int32.Parse((string)_testContextInstance.DataRow["EmployeeId"]);
         emp = getEmployeeService.GetEmployeeDetailsById(employeeId);
         Assert.IsNull(emp);
     }
 }
 public void GetEmployeeWithNonExistingEmployeeName()
 {
     using (var getEmployeeService = new GetEmployeeServiceClient())
     {
         Employee emp          = null;
         string   employeeName = _testContextInstance.DataRow["EmployeeName"].ToString();
         emp = getEmployeeService.GetEmployeeDetailsByName(employeeName);
         Assert.IsNull(emp);
     }
 }
 public void AddInValidRemark()
 {
     using (var addEmployeeService = new AddEmployeeServiceClient())
         using (var getEmployeeService = new GetEmployeeServiceClient())
         {
             int    employeeId = Int32.Parse((string)_testContextInstance.DataRow["EmployeeId"]);
             string remark     = _testContextInstance.DataRow["RemarkString"].ToString();
             addEmployeeService.AddRemarks(employeeId, remark);
             Assert.AreEqual(0, getEmployeeService.GetRemarksCount());
         }
 }
 public void AddEmployeeWithEmptyName()
 {
     using (var addEmployeeService = new AddEmployeeServiceClient())
         using (var getEmployeeService = new GetEmployeeServiceClient())
         {
             int    employeeId   = Int32.Parse((string)_testContextInstance.DataRow["EmployeeId"]);
             string employeeName = _testContextInstance.DataRow["EmployeeName"].ToString();
             addEmployeeService.CreateEmployee(employeeId, employeeName);
             Assert.AreEqual(0, getEmployeeService.GetEmployeeCount());
         }
 }
 public void AddRemarkForNonExistingEmployee()
 {
     using (var addEmployeeService = new AddEmployeeServiceClient())
         using (var getEmployeeService = new GetEmployeeServiceClient())
         {
             int    employeeId = Int32.Parse((string)_testContextInstance.DataRow["EmployeeId"]);
             string remarkText = _testContextInstance.DataRow["RemarkString"].ToString();
             addEmployeeService.AddRemarks(employeeId, remarkText);
             Assert.AreEqual(getEmployeeService.GetRemarksCount(), 0);
         }
 }
 public void ClearData()
 {
     using (var getEmployeeService = new GetEmployeeServiceClient())
     {
         if (_totalRowCount == _currentCount)
         {
             getEmployeeService.DeleteAllEMployees();
             _currentCount  = 0;
             _totalRowCount = 0;
         }
     }
 }
 public void GetEmployeesWithRemarks()
 {
     using (var addEmployeeService = new AddEmployeeServiceClient())
         using (var getEmployeeService = new GetEmployeeServiceClient())
         {
             addEmployeeService.CreateEmployee(1, "Prashant");
             addEmployeeService.AddRemarks(1, "Hey There I am using watsapp");
             addEmployeeService.CreateEmployee(2, "Prash");
             List <Employee> employeesWithRemarks = (getEmployeeService.GetEmployeesWithRemarks()).ToList();
             Assert.AreEqual(1, employeesWithRemarks.Count);
             Assert.AreEqual(2, getEmployeeService.GetEmployeeCount());
         }
 }
 public void GetAllEmployees()
 {
     using (var addEmployeeService = new AddEmployeeServiceClient())
         using (var getEmployeeService = new GetEmployeeServiceClient())
         {
             _currentCount++;
             _totalRowCount = _testContextInstance.DataRow.Table.Rows.Count;
             int    employeeId   = Int32.Parse((string)_testContextInstance.DataRow["EmployeeId"]);
             string employeeName = _testContextInstance.DataRow["EmployeeName"].ToString();
             addEmployeeService.CreateEmployee(employeeId, employeeName);
             Assert.AreEqual(_currentCount, getEmployeeService.GetAllEmployees().Count());
         }
 }
Beispiel #9
0
 public static void Main(string[] args)
 {
     using (var addEmployeeServiceClient = new AddEmployeeServiceClient())
         using (var getEmployeeServiceClient = new GetEmployeeServiceClient()) {
             try {
                 addEmployeeServiceClient.CreateEmployee(-2, "Prashant");
             }
             catch (FaultException ex)
             {
                 Console.WriteLine(ex.Message);
             }
         }
 }