protected void TestCase_GetAssociatedEntries_ManagerWithThreeOverlappingEntriesThatMatchAMsg(
            bool Entry1Override, bool Entry2Override, bool Entry3Override,
            bool Entry1Matches, bool Entry2Matches, bool Entry3Matches)
        {
            MappingManager mappingMgr = Factory_MappingManager_Default();

            IMappingEntry mappingEntry1 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 1, 16, 0, 127);

            mappingEntry1.OverrideDuplicates = Entry1Override;
            IMappingEntry mappingEntry2 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 4, 5, 10, 20);

            mappingEntry2.OverrideDuplicates = Entry2Override;
            IMappingEntry mappingEntry3 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 5, 5, 15, 15);

            mappingEntry3.OverrideDuplicates = Entry3Override;

            int id1 = mappingMgr.AddMappingEntry(mappingEntry1);
            int id2 = mappingMgr.AddMappingEntry(mappingEntry2);
            int id3 = mappingMgr.AddMappingEntry(mappingEntry3);

            MssMsg msg = Factory_MssMsg_InitializedValues(
                DEFAULT_MSG_TYPE, /*matches all entries*/
                5,                /*matches all*/
                15,               /*matches all*/
                100 /*doesn't need to match anything*/);

            var matchingEntries = mappingMgr.GetCopiesOfMappingEntriesForMsg(msg);

            Assert.IsTrue(matchingEntries.Any(entry => entry.Id == id1) == Entry1Matches);
            Assert.IsTrue(matchingEntries.Any(entry => entry.Id == id2) == Entry2Matches);
            Assert.IsTrue(matchingEntries.Any(entry => entry.Id == id3) == Entry3Matches);
        }
        public void GetAssociatedEntries_MsgMatchesFirstTwoEntriesAndOverrideDuplicatesIsTrueForTheThirdEntry_FirstTwoEntriesAreReturned()
        {
            MappingManager mappingMgr = Factory_MappingManager_Default();

            IMappingEntry mappingEntry1 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 1, 16, 0, 127);
            IMappingEntry mappingEntry2 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 1, 8, 0, 64);
            IMappingEntry mappingEntry3 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 7, 16, 60, 127);

            mappingEntry3.OverrideDuplicates = true;

            int id1 = mappingMgr.AddMappingEntry(mappingEntry1);
            int id2 = mappingMgr.AddMappingEntry(mappingEntry2);
            int id3 = mappingMgr.AddMappingEntry(mappingEntry3);

            MssMsg msg = Factory_MssMsg_InitializedValues(
                DEFAULT_MSG_TYPE, /*matches all*/
                7,                /*matches all*/
                10,               /*only matches entries 1 and 2*/
                100 /*doesn't need to match anything*/);

            var matchingEntries = mappingMgr.GetCopiesOfMappingEntriesForMsg(msg);

            Assert.IsTrue(matchingEntries.Any(entry => entry.Id == id1));
            Assert.IsTrue(matchingEntries.Any(entry => entry.Id == id2));
            Assert.IsFalse(matchingEntries.Any(entry => entry.Id == id3));
        }
        public void GetAssociatedEntries_MsgMatchesOneEntry_TheAssociatedEntryIsReturned()
        {
            MappingManager mappingMgr   = Factory_MappingManager_Default();
            IMappingEntry  mappingEntry = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 1, 3, 0, 10);
            int            newId        = mappingMgr.AddMappingEntry(mappingEntry);

            MssMsg msg = Factory_MssMsg_InitializedValues(
                DEFAULT_MSG_TYPE, /*same as type in manager*/
                2,                /*between 1 and 3*/
                5,                /*between 0 and 10*/
                100 /*doesn't need to match anything*/);

            var matchingEntries = mappingMgr.GetCopiesOfMappingEntriesForMsg(msg);

            Assert.IsTrue(matchingEntries.Any(entry => entry.Id == newId));
        }
        public void GetAssociatedEntries_MsgOnlyMatchesPartsOfEntriesInMgr_TheEnumerationReturnedIsEmpty()
        {
            MappingManager mappingMgr = Factory_MappingManager_Default();

            IMappingEntry mappingEntry1 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 1, 1, 3, 127);
            IMappingEntry mappingEntry2 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(DEFAULT_MSG_TYPE, 2, 16, 2, 2);
            IMappingEntry mappingEntry3 = Factory_IMappingEntry_MapsIdenticalMidiMsgRanges(SECONDARY_MSG_TYPE, 1, 1, 2, 2);

            mappingMgr.AddMappingEntry(mappingEntry1);
            mappingMgr.AddMappingEntry(mappingEntry2);
            mappingMgr.AddMappingEntry(mappingEntry3);

            MssMsg msg = Factory_MssMsg_InitializedValues(
                DEFAULT_MSG_TYPE, /*matches entries 1 and 2*/
                1,                /*matches entries 1 and 3*/
                2,                /*matches entries 2 and 3*/
                100 /*doesn't need to match anything*/);

            var matchingEntries = mappingMgr.GetCopiesOfMappingEntriesForMsg(msg);

            Assert.IsEmpty(matchingEntries.ToList());
        }