Step 11 : Testing the Shipper and Employee Business Objects

In this step you will test the Shipper and Employee business objects. If you skipped the previous step, we don't need to create special data retrieval methods for these business objects because we can use the generic GetAllEntities() method inherited from mmBusinessObject. This method returns all records in the associated database table. This is only acceptable for tables with a small number of records.

  1. In the Unit Test project, add the following methods to the OrderSystemTests.vb class:

    ''' <summary>
    ''' Test retrieval of all Employee entities
    ''' </summary>
    <TestMethod()>
    Public Sub TestGetAllEmployees()
    	Dim Employee As Employee = New Employee()
    	Dim EmployeeList As mmBindingList(Of EmployeeEntity) = Employee.GetAllEntities()
    	Assert.IsTrue(EmployeeList.Count > 0)
    End Sub
     
    ''' <summary>
    ''' Test retrieval of all Shipper entities
    ''' </summary>
    <TestMethod()>
    Public Sub TestGetAllShippers()
    	Dim Shipper As Shipper = New Shipper()
    	Dim ShipperList = Shipper.GetAllEntities()
    	Assert.IsTrue(ShipperList.Count > 0)
    End Sub

  2. Set a breakpoint on the first line of code in each test method.

  3. Press F5 to rebuild your business object project. In the Test Explorer, right-click the TestGetAllEmployees method and select Debug Selected Tests from the shortcut menu. This should cause you to hit the breakpoint at the top of the TestGetAllEmployees() method:

  4. Press F10 to instantiate the Employee business object, then press F10 again to return a strongly typed list of EmployeeEntity objects. If you hover your mouse pointer over the EmployeeList variable then click the + sign on the popup you should see a list of entity objects that were returned:

    You can click on the plus sign of an individual entity item to view its property values.

  5. Press F5 to finish executing the method. This should add a green check mark next to the TestGetAllEmployees method in the Test Explorer.

  6. If you want to test the Shipper business object, select TestGetAllShippers and click the Continue button.

See Also:
Step 12 : Enhancing and Testing the Customer Object


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 02/12/26
Comment or report problem with topic