示例#1
0
        public void Format_WithSuspendedSecondChordNoAdditionalTones_ShouldReturnPitchClassInUpperCaseWithAccidental(PitchClass pitchClass, Accidental accidental, string expectedValue)
        {
            // ARRANGE
            var westernChordStringFormatter = new WesternChordStringFormatter();
            var chordClass = new ChordClass(new PitchClassWithAccidental(pitchClass, accidental), TriadPattern.SuspendedSecond, ImmutableList <ChordAddedNote> .Empty);

            // ACT
            string actualValue = westernChordStringFormatter.Format(chordClass);

            // ASSERT
            actualValue.Should().Be(expectedValue);
        }
示例#2
0
        public void Format_WithUnknownTriadPattern_ShouldThrowInvalidOperationException()
        {
            // ARRANGE
            var pitchClass   = PitchClass.A;
            var accidental   = Accidental.Natural;
            var triadPattern =
                (TriadPattern)typeof(TriadPattern).GetConstructors(BindingFlags.CreateInstance | BindingFlags.Instance | BindingFlags.NonPublic)
                .First(c => c.GetParameters().FirstOrDefault()?.ParameterType == typeof(int))
                .Invoke(new object[] { -3 });
            var westernChordStringFormatter = new WesternChordStringFormatter();
            var chordClass = new ChordClass(new PitchClassWithAccidental(pitchClass, accidental), triadPattern, ImmutableList <ChordAddedNote> .Empty);

            // ACT
            Action format = () => westernChordStringFormatter.Format(chordClass);

            // ASSERT
            format.Should().ThrowExactly <InvalidOperationException>();
        }