예제 #1
0
        public void GetInversions_OneNote()
        {
            var chord      = new Chord(NoteName.C, new NoteName[0]);
            var inversions = chord.GetInversions();

            CollectionAssert.IsEmpty(inversions, "There are inversions for one-note chord.");
        }
예제 #2
0
        public void GetInversions()
        {
            var chord      = new Chord(NoteName.C, NoteName.E, NoteName.G);
            var inversions = chord.GetInversions().ToArray();

            Assert.AreEqual(2, inversions.Length, "Invalid count of inversions.");
            CollectionAssert.AreEqual(
                new[] { NoteName.E, NoteName.G, NoteName.C },
                inversions[0].NotesNames,
                "First inversion is invalid.");
            CollectionAssert.AreEqual(
                new[] { NoteName.G, NoteName.C, NoteName.E },
                inversions[1].NotesNames,
                "Second inversion is invalid.");
        }
예제 #3
0
        public void GetInversions()
        {
            var chord      = new Chord(NoteName.C, NoteName.E, NoteName.G);
            var inversions = chord.GetInversions().Select(c => c.NotesNames).ToArray();

            Assert.AreEqual(4, inversions.Length, "Invalid count of inversions.");
            AssertCollectionContainsCollection(
                inversions,
                new[] { NoteName.E, NoteName.G, NoteName.C },
                "First inversion (E G C) is invalid.");
            AssertCollectionContainsCollection(
                inversions,
                new[] { NoteName.E, NoteName.C, NoteName.G },
                "First inversion (E C G) is invalid.");
            AssertCollectionContainsCollection(
                inversions,
                new[] { NoteName.G, NoteName.C, NoteName.E },
                "Second inversion (G C E) is invalid.");
            AssertCollectionContainsCollection(
                inversions,
                new[] { NoteName.G, NoteName.E, NoteName.C },
                "Second inversion (G E C) is invalid.");
        }