コード例 #1
0
        public void ReturnStoredGameServer()
        {
            db.UpsertServerInfo(server);

            var result = handler.GetGameServer(server.endpoint);

            result.ShouldBeEquivalentTo(server.info);
        }
コード例 #2
0
        private Task <Response> GetServerAsync(string endpoint)
        {
            var task = new Task <Response>(() =>
            {
                ServerInfo server;
                try
                {
                    server = handler.GetGameServer(endpoint);
                }
                catch (Exception e)
                {
                    logger.Error(e.Message);
                    return(HttpStatusCode.InternalServerError);
                }

                return(server != null
        ? Response.AsJson(server)
        : HttpStatusCode.NotFound);
            });

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