Esempio n. 1
0
        public void FindChordMatchesContainingNote_MultipleMatchingRecords_AllMatchesFound_Test()
        {
            // Arrange
            var profile = new MidiMappingProfile
            {
                Mappings = new List <MidiMappingRecord>
                {
                    new MidiMappingRecord {
                        Trigger = new MidiInputTrigger(new[] { Pitch.C1, Pitch.E1, Pitch.G1 })
                    },
                    new MidiMappingRecord {
                        Trigger = new MidiInputTrigger(new[] { Pitch.A0, Pitch.C1, Pitch.E1 })
                    },
                    new MidiMappingRecord {
                        Trigger = new MidiInputTrigger(new[] { Pitch.G1, Pitch.B1, Pitch.C2, Pitch.FSharp2 })
                    },
                }
            };

            var matcher = new MidiMappingMatcher(profile);

            // Act
            var matchesFound = matcher.FindChordMatchesContainingNote(Pitch.C1);

            // Assert
            Assert.AreEqual(2, matchesFound.Length);
        }
Esempio n. 2
0
        public void FindChordMatchesContainingNote_EmptyMappingProfile_DoesNotMatchAnything_Test()
        {
            // Arrange
            var matcher = new MidiMappingMatcher(emptyMappingProfile);

            // Assert
            foreach (var pitch in Enum.GetValues(typeof(Pitch)).Cast <Pitch>())
            {
                Assert.AreEqual(0, matcher.FindChordMatchesContainingNote(pitch).Length);
            }
        }
Esempio n. 3
0
        public void FindChordMatchesContainingNote_NoChordsInProfile_DoesNotMatchAnything_Test()
        {
            // Arrange
            var profile = new MidiMappingProfile
            {
                Mappings = new List <MidiMappingRecord>
                {
                    new MidiMappingRecord {
                        Trigger = new MidiInputTrigger(Pitch.C1)
                    },
                    new MidiMappingRecord {
                        Trigger = new MidiInputTrigger(Pitch.A2)
                    },
                }
            };

            var matcher = new MidiMappingMatcher(profile);

            // Act
            var matchesFound = matcher.FindChordMatchesContainingNote(Pitch.C1);

            // Assert
            Assert.AreEqual(0, matchesFound.Length);
        }