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 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 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 TestDeleteEmployeeBusinessObject()
        {
            // T-SQL you may use it clear data: delete from [ADVENTUREWORKS_DATA].[HumanResources].[Employee] where LoginID='adventure-works\peter'
            var EboServiceClient = new EmployeeBoServiceClient();
            int eid = EboServiceClient.CreateEmployee2(this.CreateNewEmployee());

            var deletedentity = new Employee { EmployeeID = eid };

            // 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 TestDeleteEmployeeBusinessObject()
        {
            // T-SQL you may use it clear data: delete from [ADVENTUREWORKS_DATA].[HumanResources].[Employee] where LoginID='adventure-works\peter'
            var EboServiceClient = new EmployeeBoServiceClient();
            int eid = EboServiceClient.CreateEmployee2(this.CreateNewEmployee());

            var deletedentity = new Employee {
                EmployeeID = eid
            };

            // 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 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);
        }