Build the Dataset Test Case

Purpose:

This method will test each of the Region object's instance properties for each row of data in the test data file.

Starting Point:

The Region business object test class is under construction.  The RunTheTestCases routine should be complete.

Steps:

  1. Declare a private void function called TestTheDataset.
  2. At the top of the class, import the System.Data namespace.
  3. In the body of your new function, declare a variable of type DataSet and initialize it using the public static dataset method of the Region business object class.
  4. Verify that it contains at least four rows.
  5. The finished code should look something like this:

    private void TestTheDataset()
    {
        DataSet thisDataset = Region.theDataset();
        Assert.IsTrue(thisDataset.Tables[0].Rows.Count >= 4, "There weren't enough rows.");
    }
     
  6. Compile and Save.

Rationale

This is a simple test that can claim to do little more than exercise all of the code in the dataset.  While this serves our purposes of the moment, a production-quality test would have to do far more verification.

Discussion:

The only thing that you can assume for the completion of this test is that the code will run without error and return a dataset with four or more rows in it.  A dataset drawn from another table might easily satisfy the requirements of this test.  What would you have to do to test which table the data rows came from?

Previous Step: Build the Test Case Runner

Next Step: Create the Region Business Object Test Class