public void MultipleODataParametersShouldCreateMetadataLevelBasedOnFirstEncountered() { // We could also throw in this case, but this should have already been validated. this.parameterList.Add(new KeyValuePair <string, string>("odata.metadata", "none")); this.parameterList.Add(new KeyValuePair <string, string>("odata.metadata", "full")); JsonLightMetadataLevel.Create(this.applicationJsonMediaType, MetadataDocumentUri, Model, /*writingResponse*/ true).Should().BeOfType <JsonNoMetadataLevel>(); }
/// <summary> /// Constructs an ODataMetadataContext. /// </summary> /// <param name="isResponse">true if we are reading a response payload, false otherwise.</param> /// <param name="operationsBoundToEntityTypeMustBeContainerQualified">Callback to determine whether operations bound to this type must be qualified with the operation they belong to when appearing in a $select clause.</param> /// <param name="edmTypeResolver">EdmTypeResolver instance to resolve entity set base type.</param> /// <param name="model">The Edm model.</param> /// <param name="metadataDocumentUri">The metadata document Uri.</param> /// <param name="odataUri">The request Uri.</param> /// <param name="metadataLevel">Current Json Light MetadataLevel</param> /// <remarks>This overload should only be used by the reader.</remarks> public ODataMetadataContext( bool isResponse, Func <IEdmEntityType, bool> operationsBoundToEntityTypeMustBeContainerQualified, EdmTypeResolver edmTypeResolver, IEdmModel model, Uri metadataDocumentUri, ODataUri odataUri, JsonLightMetadataLevel metadataLevel) : this(isResponse, operationsBoundToEntityTypeMustBeContainerQualified, edmTypeResolver, model, metadataDocumentUri, odataUri) { Debug.Assert(metadataLevel != null, "MetadataLevel != null"); this.metadataLevel = metadataLevel; }
public void ODataFullMetadataParameterNotInFirstPostionShouldCreateFullMetadataLevel() { this.parameterList.Add(new KeyValuePair <string, string>("foo", "something")); this.parameterList.Add(new KeyValuePair <string, string>("odata.metadata", "full")); JsonLightMetadataLevel.Create(this.applicationJsonMediaType, MetadataDocumentUri, Model, /*writingResponse*/ true).Should().BeOfType <JsonFullMetadataLevel>(); }
public void FooMinimalMetadataShouldCreateMinimalMetadataLevel() { this.parameterList.Add(new KeyValuePair <string, string>("foo", "minimal")); JsonLightMetadataLevel.Create(this.applicationJsonMediaType, MetadataDocumentUri, Model, /*writingResponse*/ true).Should().BeOfType <JsonMinimalMetadataLevel>(); }
public void NoODataParameterShouldCreateMinimalMetadataLevel() { JsonLightMetadataLevel.Create(this.applicationJsonMediaType, MetadataDocumentUri, Model, /*writingResponse*/ true).Should().BeOfType <JsonMinimalMetadataLevel>(); }
public void ODataNoMetadataShouldCreateNoMetadataLevel() { this.parameterList.Add(new KeyValuePair <string, string>("odata.metadata", "none")); JsonLightMetadataLevel.Create(this.applicationJsonMediaType, MetadataDocumentUri, Model, /*writingResponse*/ true).Should().BeOfType <JsonNoMetadataLevel>(); }
public void MediaTypeWithNullParameterListShouldCreateMinimalMetadataLevel() { JsonLightMetadataLevel.Create(new ODataMediaType("application", "json"), MetadataDocumentUri, Model, /*writingResponse*/ true).Should().BeOfType <JsonMinimalMetadataLevel>(); }
public void ODataFullMetadataShouldCreateFullMetadataLevel() { this.parameterList.Add(new KeyValuePair <string, string>("odata.metadata", "full")); Assert.IsType <JsonFullMetadataLevel>(JsonLightMetadataLevel.Create(this.applicationJsonMediaType, MetadataDocumentUri, Model, /*writingResponse*/ true)); }