示例#1
0
        public void Validate_ODataRequestOptions_Throws_ODataException_If_IsolationLevel_NotSupported()
        {
            var odataRequestOptions = new ODataRequestOptions(
                new Uri("https://services.odata.org/OData"),
                ODataIsolationLevel.Snapshot,
                ODataMetadataLevel.Minimal,
                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.ODataIsolationLevelNotSupported("Snapshot"), odataException.Message);
            Assert.Equal(HttpStatusCode.PreconditionFailed, odataException.StatusCode);
            Assert.Equal(ODataRequestHeaderNames.ODataIsolation, odataException.Target);
        }