public void InsertMapTest()
        {
            // arrange

            // act
            InsertMap(_mapsService);
            // assert
            var maps = _mapsService.FindAll().GetAwaiter().GetResult();

            maps.Should().HaveCount(1);
        }
        public async Task <IActionResult> EditServerSelectedMaps(int serverId)
        {
            if (!await RightsHandler.HasRightsToThisPavlovServer(HttpContext.User,
                                                                 await _userservice.getUserFromCp(HttpContext.User), serverId, _service, _pavlovServerService))
            {
                return(Forbid());
            }
            var serverSelectedMap = new List <ServerSelectedMap>();
            var server            = await _pavlovServerService.FindOne(serverId);

            serverSelectedMap = (await _serverSelectedMapService.FindAllFrom(server)).ToList();

            var tmp = await _mapsService.FindAll();

            if (server.Shack)
            {
                tmp = tmp.Where(x => x.Shack && x.ShackSshServerId == server.SshServer.Id).ToArray();
            }
            else
            {
                tmp = tmp.Where(x => !x.Shack).ToArray();
            }
            var viewModel = new SelectedServerMapsViewModel
            {
                AllMaps      = tmp.ToList(),
                SelectedMaps = serverSelectedMap,
                ServerId     = serverId
            };

            return(View("ServerMaps", viewModel));
        }
Beispiel #3
0
        public void CrawlTest()
        {
            // arrange
            _steamService.CrawlSteamMaps().GetAwaiter().GetResult();
            // act
            // assert
            var maps = _mapsService.FindAll().GetAwaiter().GetResult();

            maps.Where(x => x.Name != "Vankrupt Games").ToArray().Length.Should().BeGreaterThan(1);
        }