public void WhenScaleInstanceIsCreated_ThenNotesCountIsCorrect() { // Arrange var sourceScale = this.chordData.Scales[0]; var noteNames = NoteSequenceUtilities.GetNotes(this.chordData, "bb", sourceScale); // Act var scaleInstance = ScaleInstance.Create(sourceScale.Description, sourceScale.Notes, noteNames.ToList()); // Assert Assert.AreEqual(sourceScale.Notes.Count, scaleInstance.Notes.Count); }
public void WhenChordInstanceIsCreated_ThenDisplayNameIsCorrect() { // Arrange var sourceChord = this.chordData.Chords[0]; var noteNames = NoteSequenceUtilities.GetNotes(this.chordData, "bb", sourceChord); // Act var chordInstance = ChordInstance.Create(sourceChord.Description, sourceChord.Notes, noteNames.ToList()); // Assert Assert.AreEqual("Bb/A# Major", chordInstance.DisplayName); }
public IEnumerable <ChordInstance> ChordNotes(string root, string searchTerm) { searchTerm = searchTerm.Trim(); this.logger.LogInformation($"APP LOGGING ===> ChordNotes with root: {root} and searchTerm: {searchTerm}"); var chordResults = NoteSequenceUtilities.SearchDescriptions(this.chordData.Chords, searchTerm); var chordArray = chordResults as Chord[] ?? chordResults.ToArray(); var chordInstances = new List <ChordInstance>(chordArray.Length); foreach (var chord in chordArray) { var chordInstance = ChordInstance.Create( chord.Description, chord.Notes, (List <string>)NoteSequenceUtilities.GetNotes(this.chordData, root, chord)); chordInstances.Add(chordInstance); } return(chordInstances); }
public IEnumerable <ScaleInstance> ScaleNotes(string root, string searchTerm) { searchTerm = searchTerm.Trim(); this.logger.LogInformation($"APP LOGGING ===> ScaleNotes with root: {root} and searchTerm: {searchTerm}"); var scaleResults = NoteSequenceUtilities.SearchDescriptions(this.chordData.Scales, searchTerm); var scaleArray = scaleResults as Scale[] ?? scaleResults.ToArray(); var scaleInstances = new List <ScaleInstance>(scaleArray.Length); foreach (var scale in scaleArray) { var scaleInstance = ScaleInstance.Create( scale.Description, scale.Notes, (List <string>)NoteSequenceUtilities.GetNotes(this.chordData, root, scale)); scaleInstances.Add(scaleInstance); } return(scaleInstances); }
public void WhenGetNotesIsCalledForBbASharpMajorSixthTetrad_ThenBbDbFNoteNamesIsReturned() { // Arrange var sourceChord = this.chordData.Chords[6]; var expectedNotes = new[] { "Bb/A#", "D", "F", "G" }; // Act var notes = NoteSequenceUtilities.GetNotes(this.chordData, "Bb", sourceChord); // Assert Assert.IsNotNull(notes); var notesArray = notes as string[] ?? notes.ToArray(); Assert.AreEqual(4, notesArray.Length); for (var noteIndex = 0; noteIndex < 4; noteIndex++) { Assert.AreEqual(expectedNotes[noteIndex], notesArray[noteIndex]); } }
public void WhenGetNotesIsCalledForCMajorTriad_ThenCEGNoteNamesIsReturned() { // Arrange var sourceChord = this.chordData.Chords[0]; var expectedNotes = new[] { "C", "E", "G" }; // Act var notes = NoteSequenceUtilities.GetNotes(this.chordData, "c", sourceChord); // Assert Assert.IsNotNull(notes); var notesArray = notes as string[] ?? notes.ToArray(); Assert.AreEqual(3, notesArray.Length); for (var noteIndex = 0; noteIndex < 3; noteIndex++) { Assert.AreEqual(expectedNotes[noteIndex], notesArray[noteIndex]); } }