Exemple #1
0
 private void SendRequest(string uri, string parameters)
 {
     using (var client = new WebClient())
     {
         client.Headers[HttpRequestHeader.ContentType] = Client.ContentType;
         var json = client.UploadString(uri, parameters);
         this.Response = GameResponse.FromJson(json);
     }
 }
Exemple #2
0
        public GameResponse GetAll()
        {
            GameResponse gm   = null;
            var          json = ReadFile();

            if (json != null)
            {
                gm = GameResponse.FromJson(json);
            }

            return(gm);
        }
Exemple #3
0
        public void FromJson_GameResponseString_AreEqual()
        {
            var json = "";

            using (var stream = GetType().Assembly.GetManifestResourceStream("Vindinium.UnitTests.Serialization.GameResponse.json"))
            {
                using (var reader = new StreamReader(stream))
                {
                    json = reader.ReadToEnd();
                }
            }

            var act = GameResponse.FromJson(json);

            Assert.AreEqual("##############        ############################        ##############################    ##############################$4    $4############################  @4    ########################  @1##    ##    ####################  []        []  ##################        ####        ####################  $4####$4  ########################  $4####$4  ####################        ####        ##################  []        []  ####################  @2##    ##@3  ########################        ############################$-    $-##############################    ##############################        ############################        ##############", act.game.board.tiles);
        }