예제 #1
0
        private async Task SetUpGameModeAndSetting()
        {
            var currentMatch = await _repoServiceFactory.MatchRepoService.GetCurrentMatch();

            if (currentMatch != null) //there is no matches, this is the first time we are starting the server.
            {
                _currentMatchSettings =
                    (DatabaseModel.JackpotSetting) await _gameModeSettingService.Find(currentMatch.SettingId, GameModeType.JackpotCsgo);
            }
            _gameMode = await _repoServiceFactory.GameModeRepoService.Find(GameModeHelper.GetStringFromType(GameModeType.JackpotCsgo));
        }
예제 #2
0
        public async void GetCurrentMatchSuccess()
        {
            var matchToReturn = new DatabaseModel.Match(1, "salt", "hash", 10.ToString(CultureInfo.InvariantCulture), 1, null, null, 1, 0,
                                                        DateTime.Now, 1);


            A.CallTo(() => _fakeMatchRepoServicey.GetCurrentMatch()).Returns(matchToReturn);

            A.CallTo(() => _fakedGameModeSettingService.Find(A <int> ._, A <GameModeType> ._))
            .Returns(new DatabaseModel.JackpotSetting(0, 0, 50, 0, 0, 0, 0, 0, true, false, ""));


            A.CallTo(() => _fakeBetService.GetBettedItemsOnMatch(1, matchToReturn.GameModeId)).Returns(new List <Item>
            {
                new Item
                {
                    IconUrl = "imageUrl",
                    Name    = "name1",
                    Value   = 10,
                    Owner   = new User
                    {
                        ImageUrl = "userImage",
                        Name     = "userName",
                        SteamId  = "123456789"
                    }
                },
                new Item
                {
                    IconUrl = "imageUrl",
                    Name    = "name1",
                    Value   = 10,
                    Owner   = new User
                    {
                        ImageUrl = "userImage",
                        Name     = "userName",
                        SteamId  = "123456789"
                    }
                },
                new Item
                {
                    IconUrl = "imageUrl",
                    Name    = "name1",
                    Value   = 13,
                    Owner   = new User
                    {
                        ImageUrl = "userImage",
                        Name     = "userName",
                        SteamId  = "123456789"
                    }
                },
            });

            var jackpotMatchManager = new JackpotMatchManager(
                _fakedRepoServiceFactory,
                _fakeBetService,
                _fakeHashService,
                _fakeRandomService,
                A.Dummy <IJackpotDraftService>(),
                A.Dummy <ILogServiceFactory>(),
                A.Dummy <IBetOrWithdrawQueueManager>(),
                _fakedGameModeSettingService,
                _fakedBetHub,
                _fakedMatchHub,
                A.Dummy <IDiscordService>()
                );
            var currentJackpotMatch = await jackpotMatchManager.GetCurrentMatch();


            Assert.Equal("hash", currentJackpotMatch.Hash);
            Assert.Equal(null, currentJackpotMatch.Salt);
            Assert.Equal(null, currentJackpotMatch.Percentage);
            Assert.Equal(1.ToString(), currentJackpotMatch.RoundId.ToString());
            Assert.Equal(MatchStatus.Open, currentJackpotMatch.Status);
            Assert.Equal("open", currentJackpotMatch.ReadableStatus.ToLower());
            Assert.Equal(3, currentJackpotMatch.ItemsInPool.Count);
            Assert.Equal(33, currentJackpotMatch.ValueInPool);
            Assert.Equal(1, currentJackpotMatch.Bets.Count);
            Assert.Equal(50, currentJackpotMatch.Setting.ItemLimit);

            A.CallTo(() => _fakedGameModeSettingService.Find(1, GameModeType.JackpotCsgo)).MustHaveHappened();
        }