Example #1
0
        public void Flattened_WhenDecrementing_ShouldReturnCorrectOctaveShift(AbstractMusicNote initialAbstractMusicNote, int decrementQuantity, int expectedOctaveShift)
        {
            int returnedOctaveShift;

            initialAbstractMusicNote.Flattened(decrementQuantity, out returnedOctaveShift);
            Assert.AreEqual(expectedOctaveShift, returnedOctaveShift);
        }
Example #2
0
        /// <summary>
        /// Returns a new flattened instance of the current
        /// <see cref="MusicNote"/>.
        /// </summary>
        /// <param name="decrementQuantity">
        /// An <see cref="int"/> representing the number of semitones to
        /// flatten this instance of <see cref="MusicNote"/> by.
        /// </param>
        /// <returns>
        /// A new flattened instance of the current <see cref="MusicNote"/>.
        /// </returns>
        /// <remarks>
        /// Depending on the starting <see cref="MusicNote"/> and the
        /// <paramref name="decrementQuantity"/>, both <see cref="Value"/> and
        /// <see cref="Octave"/> may be changed. This is based on whether the
        /// new <see cref="MusicNote"/> <see cref="Value"/> would cross over an
        /// octave boundary, therefore modifying the related
        /// <see cref="Octave"/>.
        /// </remarks>
        public MusicNote Flattened(int decrementQuantity)
        {
            int returnedOctaveShift;

            AbstractMusicNote flattenedAbstractMusicNote = Value.Flattened(decrementQuantity, out returnedOctaveShift);

            if (HasOctave())
            {
                return(new MusicNote(flattenedAbstractMusicNote, Octave + returnedOctaveShift));
            }
            else
            {
                return(new MusicNote(flattenedAbstractMusicNote, null));
            }
        }
Example #3
0
        public void Flattened_WhenDecrementingWithOctaveShift_ShouldReturnCorrectAbstractMusicNote(AbstractMusicNote initialAbstractMusicNote, int decrementQuantity, AbstractMusicNote expectedAbstractMusicNote)
        {
            int returnedOctaveShift;

            Assert.AreEqual(expectedAbstractMusicNote, initialAbstractMusicNote.Flattened(decrementQuantity, out returnedOctaveShift));
        }