Ejemplo n.º 1
0
        public IEnumerable <ResponseJson> GetPlayers()
        {
            ResponseJson     response = null;
            InitializeClient client   = new InitializeClient(new InitializeClient.EndpointConfiguration());

            try
            {
                var task = client.GetPlayersGameAsync();
                task.Wait();
                if (task.IsCompletedSuccessfully)
                {
                    response = task.Result;
                }
                else
                {
                    response = new ResponseJson {
                        Code = -1, Message = "Cannot insert move"
                    }
                };
            }
            catch (Exception e)
            {
                client.LogErrorAsync(e.StackTrace);
                response = new ResponseJson {
                    Code = -10, Message = "An error has ocurred, please try it later"
                };
            }
            finally
            {
                client.LogsAsync("GetPlayers", "", ParseObjectToJson(response));
            }
            return(ToEnumerable <ResponseJson>(response));
        }
Ejemplo n.º 2
0
        public void GetPlayersTest()
        {
            ResponseJson response = null;

            try
            {
                InitializeClient client = new InitializeClient(new InitializeClient.EndpointConfiguration());
                var task = client.GetPlayersGameAsync();
                task.Wait();
                if (task.IsCompletedSuccessfully)
                {
                    response = task.Result;
                }

                Assert.IsNotNull(response);
            }
            catch
            {
                throw;
            }
        }