public void TestGetArrayProperties() { AnyValueArray list = AnyValueArray.FromValues(123, "ABC"); var names = ObjectReader.GetPropertyNames(list); Assert.Equal(2, names.Count); Assert.Contains("0", names); Assert.Contains("1", names); var values = ObjectReader.GetProperties(list); Assert.Equal(2, values.Count); Assert.Equal(123, values["0"]); Assert.Equal("ABC", values["1"]); var array = new object[] { 123, "ABC" }; names = ObjectReader.GetPropertyNames(array); Assert.Equal(2, names.Count); Assert.Contains("0", names); Assert.Contains("1", names); values = ObjectReader.GetProperties(array); Assert.Equal(2, values.Count); Assert.Equal(123, values["0"]); Assert.Equal("ABC", values["1"]); }
public void TestGetObjectProperties() { var obj = new TestClass(); var names = ObjectReader.GetPropertyNames(obj); Assert.Equal(3, names.Count); Assert.Contains("PublicField", names); Assert.Contains("PublicProp", names); var map = ObjectReader.GetProperties(obj); Assert.Equal(3, map.Count); Assert.Equal("ABC", map["PublicField"]); Assert.NotNull(map["PublicProp"]); }
public void TestGetMapProperties() { AnyValueMap map = AnyValueMap.FromTuples( "key1", 123, "key2", "ABC" ); var names = ObjectReader.GetPropertyNames(map); Assert.Equal(2, names.Count); Assert.Contains("key1", names); Assert.Contains("key2", names); var values = ObjectReader.GetProperties(map); Assert.Equal(2, values.Count); Assert.Equal(123, values["key1"]); Assert.Equal("ABC", values["key2"]); }