Beispiel #1
0
        public void Create_four_note_chord_with_inverted_notes_second_inversion()
        {
            var chord = Chord.FromNotes("G4 C5 E5 B5");

            chord.Inversion.Should().Be(2);
            chord.Should().Be(new Chord("Cmaj7^^"));
        }
Beispiel #2
0
        public void Create_four_note_chord_with_inverted_notes_first_inversion()
        {
            var chord = Chord.FromNotes("E4 G4 B4 C5");

            chord.Inversion.Should().Be(1);
            chord.Should().Be(new Chord("C5maj7^"));
        }
Beispiel #3
0
        public void Create_three_note_chord_with_inverted_notes()
        {
            var chord = Chord.FromNotes("E4 G4 C5");

            Assert.Equal(1, chord.Inversion);
            chord.Should().Be(new Chord("C5maj^"));
        }
Beispiel #4
0
        public void Create_three_note_chord_with_notes_in_wrong_order()
        {
            var chord = Chord.FromNotes("E G C");

            chord.Inversion.Should().Be(0);
            chord.Should().Be(new Chord("Cmaj"));
        }
Beispiel #5
0
        public void Create_chord_with_notes_using_note_array_constructor()
        {
            var chord = Chord.FromNotes(new[]
            {
                new Note("D"),
                new Note("F#"),
                new Note("A"),
            });

            chord.Should().Be(new Chord("Dmaj"));
        }
Beispiel #6
0
        public void Create_four_note_chord_with_inverted_notes_third_inversion()
        {
            var chord = Chord.FromNotes("B4 C5 E5 G5");

            chord.Inversion.Should().Be(3);
            chord.Should().Be(new Chord("C5maj7^^^"));
            var expectedBassNote = new Note("B")
            {
                IsOctaveExplicitlySet = true
            };

            chord.GetBassNote().Should().Be(expectedBassNote);
        }
Beispiel #7
0
        public void SortsElements()
        {
            var notes = new List <Note>()
            {
                new Note(Pitch.C4),
                new Note(Pitch.D2),
                new Note(Pitch.E3),
                new Note(Pitch.A6)
            };

            var expectedElementPitches = new List <Pitch>()
            {
                Pitch.D2, Pitch.E3, Pitch.C4, Pitch.A6
            };

            var chord = Chord.FromNotes(notes);

            Assert.AreEqual(expectedElementPitches.Count, chord.notes.Length);

            for (int i = 0; i < expectedElementPitches.Count; i++)
            {
                Assert.AreEqual(expectedElementPitches[i], chord.notes[i].pitch);
            }
        }
Beispiel #8
0
        public void Create_chord_with_notes_using_string_array_constructor()
        {
            var chord = Chord.FromNotes(new[] { "Bb", "Db", "F" });

            chord.Should().Be(new Chord("Bbmin^"));
        }
Beispiel #9
0
        public void Create_chord_with_notes_using_string_constructor()
        {
            var chord = Chord.FromNotes("C E G");

            chord.Should().Be(new Chord("Cmaj"));
        }
Beispiel #10
0
        public void Create_chord_with_many_similar_notes()
        {
            var chord = Chord.FromNotes("F3 F4 F5 A6 A5 C4 C3");

            chord.Should().Be(new Chord("Fmaj^^"));
        }
Beispiel #11
0
        public void Create_chord_with_notes_in_different_octaves()
        {
            var chord = Chord.FromNotes("C3 E5 G7");

            chord.Should().Be(new Chord("Cmaj"));
        }