public void CanSerializeResourceWithDictionaryThatIsARelationship() { var model = new ModelWithDictionaryProperty { Id = "1", Type = "model", Dictionary = new ModelImplementingDictionary { Id = "2", Type = "dictionaries" } }; model.Dictionary["k1"] = "v1"; var json = model.Serialize(); Assert.Equal(@" { 'data': { 'id': '1', 'type': 'model', 'attributes': { 'dictionary': { 'k1': 'v1' } } } }".Format(), json, JsonStringEqualityComparer.Default); }
public void Constructing_WithModelContainingDictionaryProperty_DoesNotAddTheProperty() { const string propertyName = "Property"; Dictionary <string, object> value = new Dictionary <string, object> { { "some-string", new { id = "123", name = "Some Anonymous Type" } } }; var model = new ModelWithDictionaryProperty { Property = value }; var graph = new HalGraph(model); Assert.Null(graph[propertyName]); }