コード例 #1
0
        public void TestGetEmployeeBusinessObject()
        {
            var      EboServiceClient = new EmployeeBoServiceClient();
            Employee employee         = EboServiceClient.GetEmployee(1);

            Assert.NotNull(employee);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void TestGetEmployeeBusinessObject()
 {
     CreateWCFServiceHost(() =>
     {
         var EboServiceClient = new EmployeeBoServiceClient();
         var employee         = EboServiceClient.GetEmployee(1);
         Assert.NotNull(employee);
     });
 }
コード例 #4
0
        public void TestGetEmployeeList_With_NullCondition()
        {
            var EboServiceClient = new EmployeeBoServiceClient();
            int totalcount       = 0;
            var employee         = EboServiceClient.FindEmployeeByTitle(out totalcount, null, 1, 10);

            Assert.NotNull(employee);
            Assert.Equal(10, employee.Count);
        }
コード例 #5
0
        public void TestGetEmployeeList()
        {
            var EboServiceClient = new EmployeeBoServiceClient();
            int totalcount       = 0;
            var employee         = EboServiceClient.FindEmployeeByTitle(out totalcount, "Technician", 1, 10);

            Assert.NotNull(employee);
            Assert.Equal(10, employee.Count);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 public void TestGetEmployeeList()
 {
     var EboServiceClient = new EmployeeBoServiceClient();
     int totalcount = 0;
     var employee = EboServiceClient.FindEmployeeByTitle(out totalcount,"Technician", 1, 10);
     Assert.NotNull(employee);
     Assert.Equal(10, employee.Count);
 }
コード例 #11
0
 public void TestGetEmployeeBusinessObject()
 {
     var EboServiceClient = new EmployeeBoServiceClient();
     Employee employee = EboServiceClient.GetEmployee(1);
     Assert.NotNull(employee);
 }
コード例 #12
0
        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);
        }
コード例 #13
0
 public void TestGetEmployeeList_With_NullCondition()
 {
     var EboServiceClient = new EmployeeBoServiceClient();
     int totalcount = 0;
     var employee = EboServiceClient.FindEmployeeByTitle(out totalcount,null, 1, 10);
     Assert.NotNull(employee);
     Assert.Equal(10, employee.Count);
 }
コード例 #14
0
 public void TestGetEmployeeBusinessObject()
 {
     CreateWCFServiceHost(() =>
     {
         var EboServiceClient = new EmployeeBoServiceClient();
         var employee = EboServiceClient.GetEmployee(1);
         Assert.NotNull(employee);
     });
       
 }