示例#1
0
        public void ReturnAllServers()
        {
            foreach (var serverInfo in TestData.Servers)
            {
                db.UpsertServerInfo(serverInfo);
            }

            var result = handler.GetGameServers();

            result.Should().BeEquivalentTo(TestData.Servers.Select(s => s));
        }
示例#2
0
        private Task <Response> GetServersAsync()
        {
            var task = new Task <Response>(() =>
            {
                GameServer[] servers;
                try
                {
                    servers = handler.GetGameServers();
                }
                catch (Exception e)
                {
                    logger.Error(e.Message);
                    return(HttpStatusCode.InternalServerError);
                }
                return(Response.AsJson(servers));
            });

            task.Start();
            return(task);
        }