Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }