コード例 #1
0
        public void BuildUserResultsTestsHappyPath()
        {
            Database.SetInitializer<SelectumContext>(null);
            SelectumContext db = new SelectumContext();

            var controller = new AdminController();
            int gameFilterId = 6;
            List<User> users = db.Users.ToList();

            var thisGameFiltersUsersGameSelections = db.UserGameResults
                                                        .Include(ugs => ugs.UserGameSelection)
                                                        .Include(ugs => ugs.UserGameSelection.GameSpread)
                                                        .Include(ugs => ugs.UserGameSelection.GameSpread.Game)
                                                        .Include(ugs => ugs.UserGameSelection.User)
                                                        .Include(ugs => ugs.UserGameSelection.PickTeam)
                                                        .Where(ugs => ugs.UserGameSelection.GameSpread.Game.GameFilterId == gameFilterId)
                                                        .ToList();
            var actual = controller.BuildUserResults(gameFilterId, thisGameFiltersUsersGameSelections, users);
            Assert.Inconclusive("This is just a test harness");
        }
コード例 #2
0
        public void BuildUserResultsTestsRebuildTable()
        {
            Database.SetInitializer<SelectumContext>(null);
            SelectumContext db = new SelectumContext();

            db.UserResults.ToList().ForEach(ur => db.UserResults.Remove(ur));
            db.SaveChanges();

            var controller = new AdminController();
            List<User> users = db.Users.ToList();
            for (int i = 1; i <= 14; i++)
            {
                int gameFilterId = i;

                var thisGameFiltersUsersGameSelections = db.UserGameResults
                                                            .Include(ugs => ugs.UserGameSelection)
                                                            .Include(ugs => ugs.UserGameSelection.GameSpread)
                                                            .Include(ugs => ugs.UserGameSelection.GameSpread.Game)
                                                            .Include(ugs => ugs.UserGameSelection.User)
                                                            .Include(ugs => ugs.UserGameSelection.PickTeam)
                                                            .Where(ugs => ugs.UserGameSelection.GameSpread.Game.GameFilterId == gameFilterId)
                                                            .ToList();
                var userResults = controller.BuildUserResults(gameFilterId, thisGameFiltersUsersGameSelections, users);
                userResults.ForEach(ur => db.UserResults.Add(ur));
                db.SaveChanges();
            }
            Assert.Fail("This should not be ran except for manually");
        }