public void ConvertComplexTypeWithJsonAttributeToObjectShouldUseAttributeAsPropertyName() { var complexType = new ComplexTypeWithJson { String = "String", List = new List<string>(), IntDictionary = new Dictionary<int, string>() }; var result = ConvertToObjectHelper.ConvertStrongTypeToObject(complexType); Assert.Equal(typeof(Dictionary<string, object>), result.GetType()); Assert.Equal(typeof(object[]), ((Dictionary<string, object>)result)["list"].GetType()); Assert.Equal(typeof(Dictionary<string, object>), ((Dictionary<string, object>)result)["dict"].GetType()); }
public void ConvertComplexTypeWithJsonAttributeToObjectShouldUseAttributeAsPropertyName() { var complexType = new ComplexTypeWithJson { String = "String", List = new List <string>(), IntDictionary = new Dictionary <int, string>() }; var result = ConvertToObjectHelper.ConvertStrongTypeToObject(complexType); Assert.Equal(typeof(Dictionary <string, object>), result.GetType()); Assert.Equal(typeof(object[]), ((Dictionary <string, object>)result)["list"].GetType()); Assert.Equal(typeof(Dictionary <string, object>), ((Dictionary <string, object>)result)["dict"].GetType()); }