Esempio n. 1
0
 public void DeleteEmployee(string name)
 {
     try
     {
         using (var client = new CreateOrModifyEmployeeClient())
         {
             client.DeleteEmployeeByName(name);
         }
     }
     catch (FaultException <EmployeeDoesNotExists> ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        public void TestDeleteExistingEmployeeByName()
        {
            using (var createClient = new CreateOrModifyEmployeeClient())
            {
                createClient.CreateEmployee("sid", "watta boy");
                createClient.CreateEmployee("vinayak", "awesome boy");
                createClient.CreateEmployee("saif", "smelly boy");

                using (var retrieveClient = new RetrieveEmpDetailsClient())
                {
                    var empList = retrieveClient.GetAllEmployeeList();
                    Assert.AreEqual(empList.Length, 3);
                }

                createClient.DeleteEmployeeByName("saif");

                using (var retrieveClient = new RetrieveEmpDetailsClient())
                {
                    var empList = retrieveClient.GetAllEmployeeList();
                    Assert.AreEqual(empList.Length, 2);
                }
            }
        }