public void Algorithm_QualityStep_PostExpiration_IncrementingBy2()
        {
            var    pre   = 0;
            var    post  = 2;
            var    algo  = new QualityStepAlgorithm(pre, post);
            IAward award = new AcmePartnerFacilityAward(0, TimeSpan.FromDays(0));

            award.IncrementDay();
            Assert.IsTrue(award.IsExpired);

            var runner = new AwardAlgorithmRunner(algo);

            runner.Add(award);

            // NOTE: we do 25 iterations to avoid the 50 quality cap which will mess with our
            //       our nice simple loop to check qualities
            //
            runner.RunAlgorithm(25);
            var history = runner.AwardInfos[0].history;

            for (var i = 0; i < history.Count; i++)
            {
                Assert.AreEqual(i * 2, history[i], $"Algorithm history mismatch on iteration '{i}'");
            }
        }
        public void Algorithm_QualityStep_PreExpiration_IncrementingBy1()
        {
            var    step  = 1;
            var    algo  = new QualityStepAlgorithm(step, step);
            IAward award = new AcmePartnerFacilityAward(0, TimeSpan.FromDays(60));

            var runner = new AwardAlgorithmRunner(algo);

            runner.Add(award);
            runner.RunAlgorithm(50);
            var history = runner.AwardInfos[0].history;

            for (var i = 0; i < history.Count; i++)
            {
                Assert.AreEqual(i, history[i], $"Algorithm history mismatch on iteration '{i}'");
            }
        }
        public void Algorithm_QualityStep_AcrossExpiration_Decrementing()
        {
            var    pre   = -1;
            var    post  = -2;
            var    algo  = new QualityStepAlgorithm(pre, post);
            IAward award = new AcmePartnerFacilityAward(10, TimeSpan.FromDays(1));

            award.IncrementDay();
            Assert.IsFalse(award.IsExpired);
            award = algo.Run(award);

            Assert.AreEqual(9, award.Quality);

            award.IncrementDay();
            Assert.IsTrue(award.IsExpired);
            award = algo.Run(award);
            Assert.AreEqual(7, award.Quality);
        }
        public void Award_AcmePartnerFacility()
        {
            IAward award = new AcmePartnerFacilityAward(10, TimeSpan.FromDays(1));
            var    algo  = award.UpdateAlgorithm;

            Assert.IsFalse(award.IsExpired);
            Assert.IsTrue(award.IsNotExpired);
            Assert.AreEqual(10, award.Quality);

            award.IncrementDay();
            award = algo.Run(award);
            Assert.AreEqual(9, award.Quality);
            Assert.IsFalse(award.IsExpired);
            Assert.IsTrue(award.IsNotExpired);

            award.IncrementDay();
            award = algo.Run(award);
            Assert.AreEqual(7, award.Quality);
            Assert.IsTrue(award.IsExpired);
            Assert.IsFalse(award.IsNotExpired);
        }
        public void Algorithm_QualityStep_PostExpiration_DecrementingBy1()
        {
            var    pre   = 0;
            var    post  = -1;
            var    algo  = new QualityStepAlgorithm(pre, post);
            IAward award = new AcmePartnerFacilityAward(50, TimeSpan.FromDays(0));

            award.IncrementDay();
            Assert.IsTrue(award.IsExpired);

            var runner = new AwardAlgorithmRunner(algo);

            runner.Add(award);
            runner.RunAlgorithm(50);
            var history = runner.AwardInfos[0].history;

            for (var i = 0; i < history.Count; i++)
            {
                Assert.AreEqual(50 - i, history[i], $"Algorithm history mismatch on iteration '{i}'");
            }
        }