public void EvaluateCompositionWithoutMultipleLeaps()
        {
            const int expectedEvaluation = 0;
            var       composition        = _factory.CreateComposition();

            composition.AddNotes(1, 3, _factory.CreateCompositionContext(), new NoteChoice());
            composition.AddNotes(2, 4, _factory.CreateCompositionContext(), new NoteChoice());
            composition.AddNotes(3, 5, _factory.CreateCompositionContext(), new NoteChoice());
            composition.AddNotes(7, 2, _factory.CreateCompositionContext(), new NoteChoice());

            var evaluation = _ruleEvaluator.EvaluateComposition(composition);

            Assert.AreEqual(expectedEvaluation, evaluation);

            var detrimentalNotePairCount = composition.GetNotePairs().Count(notePair => notePair.IsDetrimental);

            Assert.AreEqual(expectedEvaluation, detrimentalNotePairCount);
        }
        /// <summary>
        /// Retrieves the current composition context.
        /// </summary>
        /// <returns></returns>
        public CompositionContext GetCurrentCompositionContext()
        {
            if (_notePairs.Count > 1)
            {
                return(_compositionContexts.GetSpecificContext(
                           _factory.CreateCompositionContext(
                               _notePairs[_notePairs.Count - 2],
                               _notePairs[_notePairs.Count - 1]
                               )
                           ));
            }

            return(_compositionContexts.GetSpecificContext(
                       _factory.CreateCompositionContext(
                           NoteMotion.Descending,
                           NoteMotionSpan.Step,
                           ScaleDegree.Root,
                           NoteMotion.Descending,
                           NoteMotionSpan.Step,
                           ScaleDegree.Root
                           )
                       ));
        }
Exemple #3
0
        public void RetrievesSpecificContext()
        {
            var queryContext = _factory.CreateCompositionContext(
                NoteMotion.Ascending,
                NoteMotionSpan.Leap,
                ScaleDegree.Fifth,
                NoteMotion.Descending,
                NoteMotionSpan.Leap,
                ScaleDegree.Fourth
                );

            var resultContext = _compositionContexts.GetSpecificContext(queryContext);

            Assert.True(resultContext.Equals(queryContext));
        }
        public void ContextsAreEqual()
        {
            var leftCompositionContext = _factory.CreateCompositionContext(
                NoteMotion.Ascending,
                NoteMotionSpan.Leap,
                ScaleDegree.Fifth,
                NoteMotion.Descending,
                NoteMotionSpan.Leap,
                ScaleDegree.Fourth
                );

            var rightCompositionContext = _factory.CreateCompositionContext(
                NoteMotion.Ascending,
                NoteMotionSpan.Leap,
                ScaleDegree.Fifth,
                NoteMotion.Descending,
                NoteMotionSpan.Leap,
                ScaleDegree.Fourth
                );

            Assert.True(leftCompositionContext.Equals(rightCompositionContext));
        }