Exemplo n.º 1
0
        public void GivenImgBotCommittedLastMonth_ShouldOptimizeImagesForDailyWeeklyMonthly()
        {
            var repository = Substitute.For <IRepository>();

            var commits = new SimpleCommitLog(new[]
            {
                OneRandoCommit(DateTime.Now),
                OneRandoCommit(DateTime.Now - TimeSpan.FromDays(3)),
                OneImgbotCommit(DateTime.Now - TimeSpan.FromDays(40)),
                OneRandoCommit(new DateTime(2017, 8, 29)),
                OneImgbotCommit(new DateTime(2017, 8, 27)),
                OneImgbotCommit(new DateTime(2017, 8, 25)),
                OneRandoCommit(new DateTime(2017, 8, 20)),
            });

            repository.Commits.Returns(commits);

            Assert.IsTrue(Schedule.ShouldOptimizeImages(_dailyConfiguration, repository));

            Assert.IsTrue(Schedule.ShouldOptimizeImages(_weeklyConfiguration, repository));

            Assert.IsTrue(Schedule.ShouldOptimizeImages(_monthlyConfiguration, repository));

            Assert.IsTrue(Schedule.ShouldOptimizeImages(new RepoConfiguration(), repository));
        }
Exemplo n.º 2
0
        public void GivenImgBotNeverCommited_ShouldOptimizeImages()
        {
            var repository = Substitute.For <IRepository>();

            var commits = new SimpleCommitLog(new[]
            {
                OneRandoCommit(new DateTime(2017, 10, 31)),
                OneRandoCommit(new DateTime(2017, 10, 30)),
                OneRandoCommit(new DateTime(2017, 10, 29)),
            });

            repository.Commits.Returns(commits);

            Assert.IsTrue(Schedule.ShouldOptimizeImages(_dailyConfiguration, repository));

            Assert.IsTrue(Schedule.ShouldOptimizeImages(_weeklyConfiguration, repository));

            Assert.IsTrue(Schedule.ShouldOptimizeImages(_monthlyConfiguration, repository));

            Assert.IsTrue(Schedule.ShouldOptimizeImages(new RepoConfiguration(), repository));
        }