Example #1
0
        public void TestDeserialiseHPPResponse()
        {
            string filename;

            filename = "response-enc4.json";
            string      json = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, @"Data", filename));
            HPPResponse resp = JsonConvert.DeserializeObject <HPPResponse>(json);

            resp.IsEncoded = true;

            resp.Decode();

            Console.WriteLine("====================");
            Console.WriteLine();
            Console.WriteLine("====================");


            RealexHPP hpp = new RealexHPP()
            {
                Secret = "secret"
            };

            filename = "response-fail-enc.json";
            string json2 = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, @"Data", filename));

            HPPResponse resp2 = hpp.ResponseFromJson(json2);

            Assert.Equal(resp2.Result, "101");

            ResourceManager rm = global.cloudis.RealexHPP.HPPMessages.ResourceManager;

            Console.WriteLine(rm.GetString("hppResponse_message_unknown"));

            Assert.Null(MessageUtils.GetMessage("No message"));

            Assert.NotNull(MessageUtils.GetMessageForResult("101"));

            Assert.NotNull(MessageUtils.GetMessageForResult("508"));

            Console.WriteLine(MessageUtils.GetMessageForResult("508"));
        }