public void Clone_2() { var chord = GetChord_NonzeroTime(); Assert.IsTrue(ChordEquality.AreEqual(chord, chord.Clone()), "Clone of a chord doesn't equal to the original one."); }
public int Compare(object x, object y) { var xChord = (Chord)x; var yChord = (Chord)y; return(ChordEquality.AreEqual(xChord, yChord) ? 0 : -1); }
public void Split_TimeInsideChord_IntersectingNotAllNotes() { Func <Chord> chordCreator = TwoNotesChordCreator; var chord = chordCreator(); var time = 120; var parts = chord.Split(time); var expectedLeftChord = new Chord(new Note((SevenBitNumber)100, 20, 100)); var expectedRightChord = new Chord(new Note((SevenBitNumber)100, 180, 120), new Note((SevenBitNumber)110, 300, 130)); Assert.IsTrue(ChordEquality.AreEqual(expectedLeftChord, parts.LeftPart), "Left part is invalid."); Assert.IsTrue(ChordEquality.AreEqual(expectedRightChord, parts.RightPart), "Right part is invalid."); }
public void Split_TimeAboveEndTime() { Func <Chord> chordCreator = TwoNotesChordCreator; var chord = chordCreator(); var time = 500; var parts = chord.Split(time); Assert.IsNull(parts.RightPart, "Right part is not null."); Assert.AreNotSame(parts.LeftPart, chord, "Left part refers to the same object as the original chord."); Assert.IsTrue(ChordEquality.AreEqual(chordCreator(), parts.LeftPart), "Left part doesn't equal to the original chord."); }
public void Split_ZeroLength() { Func <Chord> chordCreator = () => new Chord(new Note((SevenBitNumber)100)); var chord = chordCreator(); var time = 0; var parts = chord.Split(time); Assert.IsNull(parts.LeftPart, "Left part is not null."); Assert.AreNotSame(parts.RightPart, chord, "Right part refers to the same object as the original chord."); Assert.IsTrue(ChordEquality.AreEqual(chordCreator(), parts.RightPart), "Right part doesn't equal to the original chord."); }