Exemplo n.º 1
0
        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 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 11
0
 public void TestGetEmployeeBusinessObject()
 {
     var EboServiceClient = new EmployeeBoServiceClient();
     Employee employee = EboServiceClient.GetEmployee(1);
     Assert.NotNull(employee);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 14
0
 public void TestGetEmployeeBusinessObject()
 {
     CreateWCFServiceHost(() =>
     {
         var EboServiceClient = new EmployeeBoServiceClient();
         var employee = EboServiceClient.GetEmployee(1);
         Assert.NotNull(employee);
     });
       
 }