private static SampleClassWithObjectMetadata CreateObjectWithMetadataToTransform() { var o = new SampleClassWithObjectMetadata { Id = 1, SomeValue = "Somevalue text test string" }; o.GetMetaData().Add("meta1", "value1"); o.GetMetaData().Add("meta2", "value2"); return(o); }
public void Creates_CompoundDocument_for_single_class_with_metadata_and_properly_map_metadata() { // Arrange var context = CreateContext(); SampleClassWithObjectMetadata objectToTransform = CreateObjectWithMetadataToTransform(); var transformer = new JsonApiTransformerBuilder() .With(CreateConfiguration()) .Build(); // Act CompoundDocument result = transformer.Transform(objectToTransform, context); // Assert var transformedObject = result.Data as SingleResource; Assert.Equal("value1", transformedObject.MetaData["meta1"]); Assert.Equal("value2", transformedObject.MetaData["meta2"]); }