public void When_modified_should_allow_changing_property_definition() { // given var context = new AutoContext <Issue>(new Uri("http://example.api/o#Issue")); var expectedMapping = JObject.Parse(@"{ '@id': 'http://example.api/o#Issue/projectId', '@type': '@id' }"); // when context.Property(i => i.ProjectId, propName => propName.Type().Id()); // then Assert.True(JToken.DeepEquals(context["projectId"], expectedMapping)); }
public void When_modified_should_allow_remapping_expanded_property_definition() { // given var contextBefore = JObject.Parse(@"{ 'projectId': { '@id': 'http://example.api/o#Issue/projectId', '@type': '@vocab' } }"); var context = new AutoContext <Issue>(contextBefore, new Uri("http://example.api/o#Issue")); var contextAfter = JObject.Parse(@" { '@id': 'http://example.api/o#Issue/projectId', '@type': '@id' }"); // when context.Property(i => i.ProjectId, propName => propName.Type().Id()); // then Assert.True(JToken.DeepEquals(context["projectId"], contextAfter)); }