public void ReflectUnitTest() { string right = @"{ ""array"": [1.44, 2, 3], ""object"": {""key1"":""value1"", ""key2"":256}, ""string"": ""The quick brown fox \""jumps\"" over the lazy dog "", ""unicode"": ""\u3041 Men\u54c8 sesiu00f3n"", ""int"": 65536, ""float"": -3.1415926e-1, ""bool"": true }" ; ReflectTest test = new ReflectTest(); JSON json = new JSON(); JSON.Value?value = json.Parse(right); Assert.IsTrue(value.HasValue); Assert.IsNotNull(value.Value.AsObject()); Assert.IsTrue(test.Read(value.Value.AsObject())); Assert.AreEqual(test.array.Length, 3); Assert.AreEqual(test.obj.key1, "value1"); Assert.AreEqual(test.obj.key2, 256); Assert.AreEqual(test.str, @"The quick brown fox ""jumps"" over the lazy dog "); Assert.AreEqual(test.i, 65536); Assert.AreEqual(test.f, -3.1415926e-1); Assert.AreEqual(test.b, true); }
public void TestReflectionEquals_DifferentTypes() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); string o2 = "testing"; Assert.IsTrue(!o1.Equals(o2)); }
public void TestReflectionEquals_NotEqualProperties() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); ReflectTest o2 = new ReflectTest(1, "hello", null); Assert.IsTrue(!o1.Equals(o2)); }
public void TestReflectionEquals() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); ReflectTest o2 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); Assert.AreEqual(o1, o2); }
public void TestReflectionEquals_Arrays() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); o1.Values = new String[] { "a", "b" }; ReflectTest o2 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); o2.Values = new String[] { "a", "b" }; Assert.AreEqual(o1, o2); }
void Awake() { _instance = this; if (useILHotFix) { hotFix = HotFixILRunTime.GetInstance(); } else { hotFix = HotFixReflector.GetInstance(); ReHotFix.loadAssemblyOver += () => ReflectTest.GetInstance(); } }
public ReflectTest(int id, string name, ReflectTest child) { this.id = id; this.name = name; this.child = child; }
public void TestReflectionToString() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); Assert.AreEqual("ReflectTest: (id=1,name=hello,Child=ReflectTest: (id=2,name=sub,Child=,Values=),Values=)", ReflectionUtil.ReflectionToString(o1)); }
public void TestReflectionEquals_DifferentTypes() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); string o2 = "testing"; Assert.IsTrue(! o1.Equals(o2)); }
public void TestReflectionEquals_NotEqualProperties() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); ReflectTest o2 = new ReflectTest(1, "hello", null); Assert.IsTrue(! o1.Equals(o2)); }
public void TestReflectionEquals_OneNull() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); Assert.IsTrue(! o1.Equals(null)); }
public void TestReflectionEquals_OneNull() { ReflectTest o1 = new ReflectTest(1, "hello", new ReflectTest(2, "sub", null)); Assert.IsTrue(!o1.Equals(null)); }