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()); }
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); }
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); }
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); }