public void Sharpened_WhenIncrementingWithOctaveShift_ShouldReturnCorrectOctaveShift(AbstractMusicNote initialAbstractMusicNote, int incrementQuantity, int expectedOctaveShift) { int returnedOctaveShift; initialAbstractMusicNote.Sharpened(incrementQuantity, out returnedOctaveShift); Assert.AreEqual(expectedOctaveShift, returnedOctaveShift); }
/// <summary> /// Returns a new sharpened instance of the current /// <see cref="MusicNote"/>. /// </summary> /// <param name="incrementQuantity"> /// An <see cref="int"/> representing the number of semitones to /// sharpen this instance of <see cref="MusicNote"/> by. /// </param> /// <returns> /// A new sharpened instance of the current <see cref="MusicNote"/>. /// </returns> /// <remarks> /// Depending on the starting <see cref="MusicNote"/> and the /// <paramref name="incrementQuantity"/>, 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 Sharpened(int incrementQuantity) { int returnedOctaveShift; AbstractMusicNote sharpenedAbstractMusicNote = Value.Sharpened(incrementQuantity, out returnedOctaveShift); if (HasOctave()) { return(new MusicNote(sharpenedAbstractMusicNote, Octave + returnedOctaveShift)); } else { return(new MusicNote(sharpenedAbstractMusicNote, null)); } }
public void Sharpened_WhenIncrementingWithoutOctaveShift_ShouldReturnCorrectAbstractMusicNote(AbstractMusicNote initialAbstractMusicNote, int incrementQuantity, AbstractMusicNote expectedAbstractMusicNote) { Assert.AreEqual(expectedAbstractMusicNote, initialAbstractMusicNote.Sharpened(incrementQuantity)); }