Exercises in this lecture   previous -- Keyboard shortcut: 'p'        Go to the notes, in which this exercise belongs -- Keyboard shortcut: 'u'   Alphabetic index   Course home      

Exercise 14.6
Unit test of struct Interval

You are given a version of struct Interval, which we have worked with in an earlier exercise. You are also given a partial test suite of struct Interval. In the given Interval test suite all tests should be successful. (You may have to adjust the full qualified names of exceptions in the ExpectedException attributes, however). Please check for yourself that all tests pass successfully.

Add a test of the indexer and a test of the OverlapWith method. Both are members of type Interval, as given above.

In the version of struct Interval from above there is at least one error in either the indexer or the OverlapWith method. You should be able to reveal the error from your tests!

Please correct the error when you have found it. Carry out a regression test.

There are several overloaded operators in struct Interval. I have only made a test of the + operator. If time allows, add some additional tests of the non-tested Interval operators.

Finally, discuss the expected coverage of my Interval test cases together with your additional Interval test cases.