private static void TestMerge() { Track a = new Track(); Track b = new Track(); a.Merge(b); Debug.Assert(a.Count == 1); ChannelMessage message = new ChannelMessage(ChannelCommand.NoteOff, 0, 60, 0); b.Insert(0, message); b.Insert(10, message); b.Insert(20, message); b.Insert(30, message); b.Insert(40, message); a.Merge(b); Debug.Assert(a.Count == 1 + b.Count - 1); a.Clear(); Debug.Assert(a.Count == 1); a.Insert(0, message); a.Insert(10, message); a.Insert(20, message); a.Insert(30, message); a.Insert(40, message); int count = a.Count; a.Merge(b); Debug.Assert(a.Count == count + b.Count - 1); Debug.Assert(a.GetMidiEvent(0).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(1).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(2).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(3).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(4).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(5).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(6).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(7).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(8).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(9).DeltaTicks == 0); }
private static void TestMerge() { Track a = new Track(); Track b = new Track(); a.Merge(b); Debug.Assert(a.Count == 1); ChannelMessage message = new ChannelMessage(ChannelCommand.NoteOff, 0, 60, 0); b.Insert(0, message); b.Insert(10, message); b.Insert(20, message); b.Insert(30, message); b.Insert(40, message); a.Merge(b); Debug.Assert(a.Count == 1 + b.Count - 1); a.Clear(); Debug.Assert(a.Count == 1); a.Insert(0, message); a.Insert(10, message); a.Insert(20, message); a.Insert(30, message); a.Insert(40, message); int count = a.Count; a.Merge(b); Debug.Assert(a.Count == count + b.Count - 1); Debug.Assert(a.GetMidiEvent(0).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(1).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(2).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(3).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(4).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(5).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(6).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(7).DeltaTicks == 0); Debug.Assert(a.GetMidiEvent(8).DeltaTicks == 10); Debug.Assert(a.GetMidiEvent(9).DeltaTicks == 0); }