Ejemplo n.º 1
0
 public void ToAndFromJson()
 {
     var obj = new TestObject(true, "private") { StringProp = "hello", NumberField = 1234 };
     var provider = new JsonStateProvider();
     var state = provider.FromNative(obj);
     var native = provider.ToNative<TestObject>(state);
     Assert.True(native.StringProp == "hello" && native.NumberField == 1234 && native.IsPrivateDefaults());
 }
Ejemplo n.º 2
0
        public void AnyToJson()
        {
            var anon = new
            {
                TextValue = "hello",
                NumberValue = 1234,
                ObjectValue = new
                {
                    BoolValue = true
                }
            };

            var provider = new JsonStateProvider();
            var state = provider.FromNative(anon);
            Assert.True(RemoveWhitespace(state).Contains("\"ObjectValue\":{\"BoolValue\":true}"));
            
        }