Beispiel #1
0
        public void DecodeResponse()
        {
            EntityResponseDecoder <Greeting> decoder = new EntityResponseDecoder <Greeting>();

            Dictionary <string, object> data = new Dictionary <string, object>()
            {
                { "id", 123 },
                { "message", "hello" },
                { "tone", "FRIENDLY" }
            };
            TransportResponse transportResponse = new TransportResponse(data, null);

            EntityResponse <Greeting> response = decoder.DecodeResponse(transportResponse);

            Greeting g = response.element;

            Assert.IsTrue(g.hasId);
            Assert.IsTrue(g.hasMessage);
            Assert.IsTrue(g.hasTone);

            Assert.AreEqual(123, g.id);
            Assert.AreEqual("hello", g.message);
            Assert.AreEqual(Tone.Symbol.FRIENDLY, g.tone.symbol);
        }
Beispiel #2
0
 public GetRequest(Dictionary <string, List <string> > headers, object id, Dictionary <string, object> queryParams, string baseUrlTemplate, Dictionary <string, object> pathKeys)
     : base(ResourceMethod.GET, null, headers, queryParams, baseUrlTemplate, pathKeys)
 {
     this.id         = id.GetType() == typeof(TKey) ? id : null;
     responseDecoder = new EntityResponseDecoder <TEntity>();
 }