public void InStreamJsonLightErrorTest() { IEnumerable <PayloadReaderTestDescriptor> testDescriptors = PayloadReaderTestDescriptorGenerator.CreateErrorReaderTestDescriptors(this.Settings); // convert the payload element to a JSON representation usable for in-stream error testing testDescriptors = testDescriptors.Select(td => { AnnotatedPayloadElementToJsonLightConverter payloadElementToJsonConverter = new AnnotatedPayloadElementToJsonLightConverter(); JsonObject jsonObject = (JsonObject)payloadElementToJsonConverter.ConvertToJsonLightValue(td.PayloadElement); Debug.Assert(td.ExpectedException == null, "Don't expect errors for regular payloads (without annotation)."); return(new PayloadReaderTestDescriptor(td) { PayloadElement = td.PayloadElement.JsonRepresentation(jsonObject) }); }); testDescriptors = testDescriptors.Select(td => td.ToInStreamErrorTestDescriptor(ODataFormat.Json)); this.CombinatorialEngineProvider.RunCombinations( testDescriptors, this.ReaderTestConfigurationProvider.JsonLightFormatConfigurations.Where(tc => !tc.IsRequest), (testDescriptor, testConfiguration) => { // These descriptors are already tailored specifically for Json Light and // do not require normalization. testDescriptor.TestDescriptorNormalizers.Clear(); testDescriptor.RunTest(testConfiguration); }); }
public void InStreamJsonLightErrorTest() { IEnumerable<PayloadReaderTestDescriptor> testDescriptors = PayloadReaderTestDescriptorGenerator.CreateErrorReaderTestDescriptors(this.Settings); // convert the payload element to a JSON representation usable for in-stream error testing testDescriptors = testDescriptors.Select(td => { AnnotatedPayloadElementToJsonLightConverter payloadElementToJsonConverter = new AnnotatedPayloadElementToJsonLightConverter(); JsonObject jsonObject = (JsonObject)payloadElementToJsonConverter.ConvertToJsonLightValue(td.PayloadElement); Debug.Assert(td.ExpectedException == null, "Don't expect errors for regular payloads (without annotation)."); return new PayloadReaderTestDescriptor(td) { PayloadElement = td.PayloadElement.JsonRepresentation(jsonObject) }; }); testDescriptors = testDescriptors.Select(td => td.ToInStreamErrorTestDescriptor(ODataFormat.Json)); this.CombinatorialEngineProvider.RunCombinations( testDescriptors, this.ReaderTestConfigurationProvider.JsonLightFormatConfigurations.Where(tc => !tc.IsRequest), (testDescriptor, testConfiguration) => { // These descriptors are already tailored specifically for Json Light and // do not require normalization. testDescriptor.TestDescriptorNormalizers.Clear(); testDescriptor.RunTest(testConfiguration); }); }