예제 #1
0
        public void LinkDecoderVisibility(BindingFlags bindings, string json, string expected)
        {
            var encoded = Encoding.UTF8.GetBytes(json);
            var decoded = LinkerTester.Decode(Linker.CreateDecoder(new JSONSchema <Visibility>(), bindings), encoded);

            Assert.AreEqual(expected, decoded.ToString());
        }
예제 #2
0
        public void LinkDecoderProperty <T>(string json, T expected)
        {
            var encoded = Encoding.UTF8.GetBytes(json);
            var decoded = LinkerTester.Decode(Linker.CreateDecoder(new JSONSchema <PropertyContainer <T> >()), encoded);

            Assert.AreEqual(expected, decoded.Property);
        }
예제 #3
0
        public void LinkDecoderArrayFromList(string json, double[] expected)
        {
            var encoded = Encoding.UTF8.GetBytes(json);
            var decoded = LinkerTester.Decode(Linker.CreateDecoder(new JSONSchema <List <double> >()), encoded);

            CollectionAssert.AreEqual(expected, decoded);
        }
예제 #4
0
        public void LinkDecoderRecursive()
        {
            var encoded = Encoding.UTF8.GetBytes("{\"r\": {\"r\": {\"v\": 42}, \"v\": 17}, \"v\": 3}");
            var decoded = LinkerTester.Decode(Linker.CreateDecoder(new JSONSchema <Recursive>()), encoded);

            Assert.AreEqual(42, decoded.r.r.v);
            Assert.AreEqual(17, decoded.r.v);
            Assert.AreEqual(3, decoded.v);
        }