private void ProcessChords_DetectionSettings_EventsCollection_WithoutPredicate( ContainerType containerType, ChordDetectionSettings settings, ICollection <MidiEvent> midiEvents, Action <Chord> action, ICollection <MidiEvent> expectedMidiEvents) { var chordsCount = midiEvents.GetChords(settings).Count; switch (containerType) { case ContainerType.EventsCollection: { var eventsCollection = new EventsCollection(); eventsCollection.AddRange(midiEvents); Assert.AreEqual( chordsCount, eventsCollection.ProcessChords(action, settings), "Invalid count of processed chords."); var expectedEventsCollection = new EventsCollection(); expectedEventsCollection.AddRange(expectedMidiEvents); MidiAsserts.AreEqual(expectedEventsCollection, eventsCollection, true, "Events are invalid."); Assert.IsTrue( eventsCollection.All(e => midiEvents.Any(ee => object.ReferenceEquals(e, ee))), "There are new events references."); } break; case ContainerType.TrackChunk: { var trackChunk = new TrackChunk(midiEvents); Assert.AreEqual( chordsCount, trackChunk.ProcessChords(action, settings), "Invalid count of processed chords."); var expectedTrackChunk = new TrackChunk(expectedMidiEvents); MidiAsserts.AreEqual(expectedTrackChunk, trackChunk, true, "Events are invalid."); Assert.IsTrue( trackChunk.Events.All(e => midiEvents.Any(ee => object.ReferenceEquals(e, ee))), "There are new events references."); } break; case ContainerType.TrackChunks: case ContainerType.File: { ProcessChords_DetectionSettings_TrackChunks_WithoutPredicate( containerType == ContainerType.File, settings, new[] { midiEvents }, action, new[] { expectedMidiEvents }); } break; } }