public void six_day_interval_after_card_is_reviewed_correctly_once()
        {
            var item     = new ReviewItemBuilder().WithLastReviewDate(_clock.Now().AddDays(-10)).WithCorrectReviewStreak(1).Build();
            var strategy = new SuperMemo2ReviewStrategy(_clock);

            var nextReview = strategy.NextReview(item);

            Assert.That(nextReview, Is.EqualTo(item.ReviewDate.AddDays(6)));
        }
        public void one_day_interval_for_items_without_correct_review()
        {
            var item     = new ReviewItemBuilder().NeverReviewed().Build();
            var strategy = new SuperMemo2ReviewStrategy(_clock);

            var nextReview = strategy.NextReview(item);

            Assert.That(nextReview, Is.EqualTo(_clock.Now()));
        }
        public void when_is_the_next_review_due()
        {
            var item = new ReviewItem
            {
                DifficultyRating    = 12,
                ReviewDate          = new DateTime(2013, 09, 18),
                CorrectReviewStreak = 8,
            };
            var strategy = new SuperMemo2ReviewStrategy();

            Debug.WriteLine(strategy.NextReview(item));
        }
        public void n_plus_2_is_interval_days_since_last_review_times_easiness_factor()
        {
            var item = new ReviewItemBuilder()
                       .WithLastReviewDate(_clock.Now().AddDays(-1))
                       .WitPreviousReviewDate(11)
                       .WithCorrectReviewStreak(3)
                       .WithDifficultyRating(DifficultyRating.Easiest)
                       .Build();
            var strategy = new SuperMemo2ReviewStrategy(_clock);

            var nextReview = strategy.NextReview(item);

            Assert.That(nextReview, Is.EqualTo(item.ReviewDate.AddDays(25)));
        }
        public void long_interval_for_easy_cards()
        {
            var difficultyRating        = DifficultyRating.Easiest;
            var daysSincePreviousReview = 11;
            var item = new ReviewItemBuilder()
                       .WithLastReviewDate(_clock.Now().AddDays(-1))
                       .WitPreviousReviewDate(daysSincePreviousReview)
                       .WithDifficultyRating(difficultyRating)
                       .WithCorrectReviewStreak(3)
                       .Build();
            var strategy = new SuperMemo2ReviewStrategy(_clock);

            var nextReview = strategy.NextReview(item);

            var expectedInterval = (daysSincePreviousReview - 1) * strategy.DifficultyRatingToEasinessFactor(difficultyRating);

            Assert.That(nextReview, Is.EqualTo(item.ReviewDate.AddDays(expectedInterval)));
        }