コード例 #1
0
        public void Should_Analyse_Partition_From_CsvFile()
        {
            string file = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "3.csv");
            var    partition = new PartitionCsvFileReader {
                Filename = file
            }.Read();
            var report = PartitionAnalyser.Analyse(partition);

            //  ------------------------------
            //      Partion Anaysis Report
            //  ------------------------------
            //  Number of Measures:            18
            //  Number of accords:             10
            //  Number of silences:            3
            //  Number of measures with notes: 5

            //  Your Partion is not in Harmony..

            //  According to this set of rules anyway:
            //  notes[A; B; D] n�of type ACCORD of A ==> next notes[;] of type SILENCE ==> next notes cannot be of type SILENCE
            //  notes[B; C; E] n�of type ACCORD of B ==> next notes[D; E; G] of type ACCORD of D ==> notes are separated by more than one high note
            //  notes[G; A; C] n�of type ACCORD of G ==> next notes[;] of type SILENCE ==> next notes cannot be of type SILENCE
            //  notes[;] n�of type SILENCE ==> next notes[G; A; G]  ==> next notes have to be of type ACCORD}
            //  notes[;] n� of type SILENCE   ==> partition cannot end with SILENCE note

            report.ReportList.Should().HaveCount(5);
            report.ReportList.Should().Contain(
                r => r.ErrorCode == ValidationError.HARMONY_NEXT_MEASUREMENT_TYPE_ACCORD_ERROR
                );
        }
コード例 #2
0
        public void Run(string filename)
        {
            // - partition
            this._reader.Filename = filename;
            var partition = this._reader.Read();

            Console.WriteLine("------------------------------");
            Console.WriteLine("   Partion Anaysis Report");
            Console.WriteLine("------------------------------");

            // - analysis result
            var report = PartitionAnalyser.Analyse(partition);

            Console.WriteLine($"Number of Measures:             {partition.Length}");
            DisplayPartitionAnalysisReport(report);
            DisplayPartitionHarmonyReport(report);
        }