Esempio n. 1
0
        public void GetBonusPointsTests9PlacedBetsReturnsMinRequired()
        {
            var modelUtils = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List<UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();
            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == 3 && ugs.GameSpreadId >= 48 && ugs.GameSpreadId <= 61).ToList();
            int minPointsRequired = 6;
            int extraPointFactorPerBetOverMin = 2;

            var actual = modelUtils.GetBonusPoints(userGameSelections, minPointsRequired, extraPointFactorPerBetOverMin);
            Assert.AreEqual(12, actual);
        }
Esempio n. 2
0
        protected override void Seed(SelectumContext context)
        {
            var initializer = new ModelDataInitializer();

            //context.Database.ExecuteSqlCommand

            var users = initializer.InitializeUsers();

            users.ForEach(u => context.Users.Add(u));
            context.SaveChanges();

            var userToUserProfiles = initializer.InitializeUserToUserProfiles();

            userToUserProfiles.ForEach(utup => context.UserToUserProfiles.Add(utup));
            context.SaveChanges();

            var teams = initializer.InitializeTeams();

            teams.ForEach(t => context.Teams.Add(t));
            context.SaveChanges();

            var gameFilters = initializer.InitializeGameFilters();

            gameFilters.ForEach(gf => context.GameFilters.Add(gf));
            context.SaveChanges();

            var games = initializer.InitializeGames();

            games.ForEach(g => context.Games.Add(g));
            context.SaveChanges();

            var gameSpreads = initializer.InitializeGameSpreads();

            gameSpreads.ForEach(g => context.GameSpreads.Add(g));
            context.SaveChanges();

            var gameResults = initializer.InitializeGameResults();

            gameResults.ForEach(gr => context.GameResults.Add(gr));
            context.SaveChanges();

            var userGameSelections = initializer.InitializeUserGameSelections();

            userGameSelections.ForEach(ugs => context.UserGameSelections.Add(ugs));
            context.SaveChanges();

            var userGameResults = initializer.InitializeUserGameResults();

            userGameResults.ForEach(ugr => context.UserGameResults.Add(ugr));
            context.SaveChanges();

            base.Seed(context);
        }
Esempio n. 3
0
        public void GetSpentPointsTestsAllSpentPointsReturnsMinCorrectly()
        {
            var modelUtils  = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List <UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();

            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == 2 && ugs.GameSpreadId >= 17 && ugs.GameSpreadId <= 32).ToList();

            var actual = modelUtils.GetSpentPoints(userGameSelections);

            Assert.AreEqual(26, actual);
        }
Esempio n. 4
0
        public void GetSpentPointsTests0SpentPointsReturnsCorrectly()
        {
            var modelUtils  = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List <UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();

            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == -1).ToList();

            var actual = modelUtils.GetSpentPoints(userGameSelections);

            Assert.AreEqual(0, actual);
        }
Esempio n. 5
0
        public void GetPlacedBetsTestsAlmostAllPlacedBetsReturnsMinCorrectly()
        {
            var modelUtils  = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List <UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();

            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == 1 && ugs.GameSpreadId >= 1 && ugs.GameSpreadId <= 16).ToList();

            var actual = modelUtils.GetPlacedBets(userGameSelections);

            Assert.AreEqual(14, actual);
        }
        public void ResultsByGameControllerTestInitialize()
        {
            var initializer = new ModelDataInitializer();

            Users              = initializer.InitializeUsers();
            Teams              = initializer.InitializeTeams();
            GameFilters        = initializer.InitializeGameFilters();
            Games              = initializer.InitializeGames();
            GameSpreads        = initializer.InitializeGameSpreads();
            GameResults        = initializer.InitializeGameResults();
            UserGameSelections = initializer.InitializeUserGameSelections();
            UserGameResults    = initializer.InitializeUserGameResults();
        }
        public virtual void Initialize()
        {
            var initializer = new ModelDataInitializer();

            Users              = initializer.InitializeUsers();
            Teams              = initializer.InitializeTeams();
            GameFilters        = initializer.InitializeGameFilters();
            Games              = initializer.InitializeGames();
            GameSpreads        = initializer.InitializeGameSpreads();
            GameResults        = initializer.InitializeGameResults();
            UserGameSelections = initializer.InitializeUserGameSelections();
            UserGameResults    = initializer.InitializeUserGameResults();
        }
Esempio n. 8
0
        public void GetBonusPointsTests16PlacedBetsReturnsMinRequired()
        {
            var modelUtils  = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List <UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();

            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == 2 && ugs.GameSpreadId >= 17 && ugs.GameSpreadId <= 32).ToList();
            int minPointsRequired             = 6;
            int extraPointFactorPerBetOverMin = 2;

            var actual = modelUtils.GetBonusPoints(userGameSelections, minPointsRequired, extraPointFactorPerBetOverMin);

            Assert.AreEqual(26, actual);
        }
 public virtual void Initialize()
 {
     var initializer = new ModelDataInitializer();
     Users = initializer.InitializeUsers();
     Teams = initializer.InitializeTeams();
     GameFilters = initializer.InitializeGameFilters();
     Games = initializer.InitializeGames();
     GameSpreads = initializer.InitializeGameSpreads();
     GameResults = initializer.InitializeGameResults();
     UserGameSelections = initializer.InitializeUserGameSelections();
     UserGameResults = initializer.InitializeUserGameResults();
 }
Esempio n. 10
0
        public void GetPlacedBetsTests0PlacedBetsReturnsCorrectly()
        {
            var modelUtils = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List<UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();
            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == -1).ToList();

            var actual = modelUtils.GetPlacedBets(userGameSelections);
            Assert.AreEqual(0, actual);
        }
Esempio n. 11
0
        public void GetSpentPointsTestsAlmostAllSpentPointsReturnsMinCorrectly()
        {
            var modelUtils = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List<UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();
            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == 1 && ugs.GameSpreadId >= 1 && ugs.GameSpreadId <= 16).ToList();

            var actual = modelUtils.GetSpentPoints(userGameSelections);
            Assert.AreEqual(19, actual);
        }
Esempio n. 12
0
        public void GetPossibleBetsTests16PossibleBetsReturnsCorrectly()
        {
            var modelUtils = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List<UserGameSelection> userGameSelections = initializer.InitializeUserGameSelections();
            userGameSelections = userGameSelections.Where(ugs => ugs.UserId == 2 && ugs.GameSpreadId >= 17 && ugs.GameSpreadId <= 32).ToList();

            var actual = modelUtils.GetPossibleBets(userGameSelections);
            Assert.AreEqual(16, actual);
        }
 public void ResultsByGameControllerTestInitialize()
 {
     var initializer = new ModelDataInitializer();
     Users = initializer.InitializeUsers();
     Teams = initializer.InitializeTeams();
     GameFilters = initializer.InitializeGameFilters();
     Games = initializer.InitializeGames();
     GameSpreads = initializer.InitializeGameSpreads();
     GameResults = initializer.InitializeGameResults();
     UserGameSelections = initializer.InitializeUserGameSelections();
     UserGameResults = initializer.InitializeUserGameResults();
 }