public void MineBoxOfficeMojoHistory_MineWeekend_ThisWeek_Filtered()
        {
            var weekendEnding = MovieDateUtil.LastSunday(DateTime.Now);
            var test          = new MineBoxOfficeMojo(weekendEnding);

            var actual = test.MineWeekend(weekendEnding);

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Any(), "The list was empty.");
            Logger.WriteLine($"Contains Estimates: {test.ContainsEstimates}");

            actual = FilterMovies(actual);

            foreach (var movie in actual)
            {
                var history = new MineBoxOfficeMojoHistory(movie.Identifier);
                var movies  = history.Mine();

                movie.SetBoxOfficeHistory(movies.First().BoxOfficeHistory);
            }

            Logger.WriteLine($"Weekend Ending: {weekendEnding}");

            WriteMovies(actual.OrderByDescending(item => item.Earnings));
        }
        public void MineBoxOfficeMojo_Mine_Previous3Weeks()
        {
            var weekendEnding = MovieDateUtil.LastSunday(DateTime.Now).AddDays(-14);
            var test          = new MineBoxOfficeMojo(weekendEnding);

            var actual = test.Mine();

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Any(), "The list was empty.");

            Logger.WriteLine($"Weekend Ending: {weekendEnding}");
            WriteMovies(actual.OrderByDescending(item => item.Earnings));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create all of the movie miners.
        /// </summary>
        /// <returns></returns>
        private List <IMiner> CreateMiners()
        {
            var result = new List <IMiner> {
                new MineFantasyMovieLeagueBoxOffice {
                    IsHidden = true
                },
                new MineMine(this)
                {
                    Weight = 1
                },
                new MineToddThatcher(),
                new MineBoxOfficePro(),
                new MineBoxOfficeMojo(),
                //new MineVisualRecreation(),
                new MineCoupe {
                    IsHidden = true, OkToMine = false
                },
                //new MineCulturedVultures(),
                new MineBoxOfficeProphet(),
                new MineBoxOfficeReport(),
                new MineTheNumbers {
                    IsHidden = true
                }
            };

            // Grab last weeks results for comparisons.  Always put this list last.

            result.Add(new MineBoxOfficeMojo(MovieDateUtil.LastSunday(MovieDateUtil.GameSunday().AddDays(-1))));

            var properties = new Dictionary <string, string>();
            var index      = 0;

            foreach (var miner in result)
            {
                properties.Add($"miner{index:00}Name", miner.Name);
                index++;
            }

            _telemetryClient.TrackTrace($"Constructed Miners", SeverityLevel.Information, properties);

            return(result);
        }
        public void MineBoxOfficeMojo_MineWeekend_ThisWeek_Filtered()
        {
            var weekendEnding = MovieDateUtil.LastSunday(DateTime.Now);
            var test          = new MineBoxOfficeMojo(weekendEnding);

            var actual = test.MineWeekend(weekendEnding);

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Any(), "The list was empty.");

            actual = FilterMovies(actual);

            Logger.WriteLine($"Weekend Ending: {weekendEnding}");
            WriteMovies(actual.OrderByDescending(item => item.Earnings));

            foreach (var item in actual.OrderByDescending(item => item.Cost))
            {
                //Logger.WriteLine($"{item.Name} {item.Cost}  {item.EarningsBase}");
                Logger.WriteLine($"{item.EarningsBase}");
            }
        }
Ejemplo n.º 5
0
        public void MineAll_Actuals_WithBestPick()
        {
            var lastSunday = MovieDateUtil.LastSunday();

            var miners    = CreateMiners();
            var minedData = MineMiners(miners);

            Logger.WriteLine($"================== Picking Movies for {lastSunday} ==================\n");

            for (int index = 0; index < miners.Count; index++)
            {
                if (minedData[index] != null &&
                    minedData[index].Any() &&
                    minedData[index][0].WeekendEnding == lastSunday &&
                    miners[index].Weight > 0)
                {
                    // Only show data that will be used.

                    WriteMoviesAndPicks($"==== {miners[index].Name} ====", minedData[index]);
                }
            }
        }
        public void MovieDateUtil_LastSunday_GivenDate()
        {
            var actual = MovieDateUtil.LastSunday(new DateTime(2017, 8, 23));

            Assert.AreEqual(new DateTime(2017, 8, 20), actual);
        }
        public void MovieDateUtil_LastSunday_IsASunday()
        {
            var actual = MovieDateUtil.LastSunday();

            Assert.AreEqual(DayOfWeek.Sunday, actual.DayOfWeek);
        }