예제 #1
0
        public void CheckUsersStore_ReturnTrue()
        {
            GamePersonTesting getMembers = new GamePersonTesting();
            var userList = getMembers.PersonData();

            Assert.True(userList.Count > 0);
        }
예제 #2
0
        public void CheckCupWinner(string cupName)
        {
            List <ScoreStatus> ScoresStatusList = new List <ScoreStatus>();

            GamePersonTesting getGameAndUser = new GamePersonTesting();

            var getAllPersons = getGameAndUser.PersonData();

            var    returned     = "";
            int    amountScores = 0;
            int    amountGames  = 0;
            double percentage   = 0;

            var ScoresList = getGameAndUser.ScoresData();
            var GamesList  = getGameAndUser.GamesData();

            var getOutGames = GamesList.Where(x => x.Name == cupName);

            foreach (var items in getAllPersons)
            {
                var text = $"{items.ContestNumber} {items.FirstName} {items.LastName}";

                amountScores = ScoresList.Where(x => x.Winner == text).Count();

                amountGames = getOutGames.Where(x => x.PersonOne == text || x.PersonTwo == text).Count();
                MathProxy proxy = new MathProxy();

                if (amountGames >= 10)
                {
                    if (amountScores == 0)
                    {
                        percentage = proxy.Mul(amountScores, amountGames);
                    }

                    percentage = proxy.Div((amountScores * 100), amountGames);

                    var ScoresStatus = new ScoreStatus(amountGames, amountScores, items.FirstName, items.LastName, percentage, items.ContestNumber);
                    ScoresStatusList.Add(ScoresStatus);
                }
            }

            var sort = ScoresStatusList.OrderByDescending(x => x.Percentage).FirstOrDefault();

            returned = $"{sort.ContestNumber} {sort.FirstName} {sort.LastName}";

            Assert.True(sort.ContestNumber == 1 && sort.FirstName == "Emma" && sort.LastName == "Pestin");
        }