Testing the Collection Capabilities

In testing the collection capabilities, in order to further understand and test the collections, I created a series of tests to implement.  These tests work with the add, insert, remove, etc methods of collections, as well as other important features.  Here are a series of tests that I have completed (note that I have renamed the Task test object to TaskTest, to make it less confusing as I develop the application.

[Test()]
public void TestAddTasks()
{
    _tasks = new CollectionBase<TaskTest>();
    TaskTest task = new TaskTest("A", DateTime.Today);
    _tasks.Add(task);

    Assert.AreEqual(1, _tasks.Count);
    Assert.IsTrue((_tasks[0] is TaskTest));
}

[Test()]
public void TestContainsTasks()
{
    _tasks = new CollectionBase<TaskTest>();

    TaskTest task = new TaskTest("A", DateTime.Today);
    _tasks.Add(task);

    Assert.IsTrue(_tasks.Contains(task));

    task = new TaskTest("B", DateTime.Today);
    _tasks.Add(task);

    task = new TaskTest("C", DateTime.Today);
    _tasks.Insert(1, task);

    Assert.IsTrue(_tasks.Contains(task));
}

[Test()]
public void TestInsertTasks()
{
    _tasks = new CollectionBase<TaskTest>();

    TaskTest task = new TaskTest("A", DateTime.Today);
    _tasks.Add(task);

    task = new TaskTest("B", DateTime.Today);
    _tasks.Add(task);

    task = new TaskTest("C", DateTime.Today);
    _tasks.Insert(1, task);

    Assert.AreEqual("C", _tasks[1].Name);
}

All of these tests run, and they come out successful.  I have two more tests not currently marked to run.  The one test is for sorting.  The team realized that we didn't have an effective way to sort, or at least had determined that we had it handled.  There are some issues with determining how we are going to sort, because we are going to want to sort by custom properties.  The team will evaluate the problem when it comes up in the specific iteration; for now, we are not working on this task.

I also had trouble with the Remove test, as noted in the next post.  For now, check out the status of the tests.
 

 

Comments

No Comments