Ejemplo n.º 1
0
        public void CastWithPayload()
        {
            var payload = new PayloadDerived
            {
                Name = "payloadName",
                Age  = 23,
                Nick = "payloadNick"
            };
            var basePod    = new JsonPod <PayloadBase, string>(payload, "podKey");
            var derivedPod = basePod.CastWithPayload <PayloadDerived>();

            Assert.Equal("payloadName", derivedPod.Payload.Name);
        }
Ejemplo n.º 2
0
        public void ToJson()
        {
            var payload = new PayloadDerived
            {
                Name = "payloadName",
                Age  = 23,
                Nick = "payloadNick"
            };
            var    pod  = payload.ToJsonPod("podKey");
            string json = pod.ToJson();

            Output.WriteLine("Serialized json: ");
            Output.WriteLine(json);

            Assert.Contains(@"""PayloadKey"": ""podKey""", json);
            Assert.Contains(@"""Name"": ""payloadName""", json);
            Assert.Contains(@"""Age"": 23", json);
            Assert.Contains(@"""Nick"": ""payloadNick""", json);
        }