Beispiel #1
0
        public void Validate_ODataRequestOptions_Throws_ODataException_If_MetadataLevel_NotSupported()
        {
            var odataRequestOptions = new ODataRequestOptions(
                new Uri("https://services.odata.org/OData"),
                ODataIsolationLevel.None,
                ODataMetadataLevel.Full,
                ODataVersion.OData40,
                ODataVersion.OData40);

            var odataServiceOptions = new ODataServiceOptions(
                ODataVersion.MinVersion,
                ODataVersion.MaxVersion,
                new[] { ODataIsolationLevel.None },
                new[] { "application/json" });

            ODataException odataException = Assert.Throws <ODataException>(() => odataServiceOptions.Validate(odataRequestOptions));

            Assert.Equal(ExceptionMessage.ODataMetadataLevelNotSupported("full", new[] { "none", "minimal" }), odataException.Message);
            Assert.Equal(HttpStatusCode.BadRequest, odataException.StatusCode);
            Assert.Equal("odata.metadata", odataException.Target);
        }