public void TestGetEmployeeBusinessObject() { var EboServiceClient = new EmployeeBoServiceClient(); Employee employee = EboServiceClient.GetEmployee(1); Assert.NotNull(employee); }
public void TestUpdateEmployeeBusinessObject() { var EboServiceClient = new EmployeeBoServiceClient(); // Insert it int eid = EboServiceClient.CreateEmployee2(this.CreateClientEmployee()); bool isSuccess = eid > 0; Assert.True(isSuccess, "Insert employee data failed"); // Get it var myEmployee = EboServiceClient.GetEmployee(eid); Assert.NotNull(myEmployee); Assert.True(myEmployee.EmployeeID > 0); // Update myEmployee.Title = "new title"; EboServiceClient.UpdateEmployee(myEmployee); // Delete it var deletedentity = new Employee { EmployeeID = myEmployee.EmployeeID }; ////Here we do not need get entity again from database.Just use attach. ////Note: EF4 context working with unity container only work well on transient mode. ////Single mode will arise The object cannot be deleted because it was not found in the ObjectStateManager ////Unity Lifetime Managers http://msdn.microsoft.com/en-us/library/ff647854.aspx //// Reference <<Entity framework 4.0 Recipes>> EboServiceClient.DelEmployee(deletedentity); }
public void TestGetEmployeeBusinessObject() { CreateWCFServiceHost(() => { var EboServiceClient = new EmployeeBoServiceClient(); var employee = EboServiceClient.GetEmployee(1); Assert.NotNull(employee); }); }
public void TestEmployeeBusinessObjectDelete2() { var eboServiceClient = new EmployeeBoServiceClient(); Employee employee = this.CreateNewEmployee(); int employid = eboServiceClient.CreateEmployee2(employee); Assert.NotNull(employee); Assert.True(employid > 0); // Get it Employee employee2 = eboServiceClient.GetEmployee(employid); // Delete it eboServiceClient.DelEmployee(employee2); }
public void TestUpdateEmployeeBusinessObject() { var EboServiceClient = new EmployeeBoServiceClient(); // Insert it int eid = EboServiceClient.CreateEmployee2(this.CreateNewEmployee()); bool isSuccess = eid > 0; Assert.True(isSuccess, "Insert employee data failed"); // Get it Employee myEmployee = EboServiceClient.GetEmployee(eid); Assert.NotNull(myEmployee); Assert.True(myEmployee.EmployeeID > 0); // Update myEmployee.Title = "new title"; EboServiceClient.UpdateEmployee(myEmployee); // Delete it var deletedentity = new Employee { EmployeeID = myEmployee.EmployeeID }; ////Here we do not need get entity again from database.Just use attach. ////Note: EF4 context working with unity container only work well on transient mode. ////Single mode will arise The object cannot be deleted because it was not found in the ObjectStateManager ////Unity Lifetime Managers http://msdn.microsoft.com/en-us/library/ff647854.aspx //// Reference <<Entity framework 4.0 Recipes>> EboServiceClient.DelEmployee(deletedentity); }