public void TestAdditionOfNotes() { // Create a measure in 3/4 time. Measure m = new Measure(new Rational(3, 4)); Note q = new Note(0, 0, new Rational(1, 4)); bool ok; ok = m.AddNote(q); Assert.IsTrue(ok); Assert.IsTrue( m.Length().CompareTo(new Rational(1, 4)) == 0 ); ok = m.AddNote(q); Assert.IsTrue(ok); Assert.IsTrue( m.Length().CompareTo(new Rational(2, 4)) == 0 ); ok = m.AddNote(q); Assert.IsTrue(ok); Assert.IsTrue( m.Length().CompareTo(new Rational(3, 4)) == 0 ); // This last addition should *not* be ok and should not change the length from 3/4 to anything else. ok = m.AddNote(q); Assert.IsFalse(ok); Assert.IsTrue( m.Length().CompareTo(new Rational(3, 4)) == 0 ); }