public void MetadataDocumentWriterErrorTest() { MetadataWriterTestDescriptor[] errorDescriptors = new MetadataWriterTestDescriptor[] { // EdmLib writes entity types without key //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.EntityTypeWithoutKey, // ExpectedODataExceptionMessage = "foo", //}, // EdmLib writes duplicate types and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.DuplicateEntityTypes, // ExpectedODataExceptionMessage = "foo2", //}, // EdmLib writes duplicate types and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.DuplicateComplexTypes, // ExpectedODataExceptionMessage = "foo3", //}, // EdmLib writes duplicate properties and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.ComplexTypeWithDuplicateProperties, // ExpectedODataExceptionMessage = "foo4", //}, // EdmLib writes duplicate properties and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.EntityTypeWithDuplicateProperties, // ExpectedODataExceptionMessage = "foo5", //}, }; IEnumerable <MetadataWriterErrorTestCase> testCases = errorDescriptors.Select(desc => new MetadataWriterErrorTestCase { TestDescriptor = desc, }); IEnumerable <MetadataWriterErrorTestCase> manualTestCases = new MetadataWriterErrorTestCase[] { new MetadataWriterErrorTestCase { TestDescriptor = new MetadataWriterTestDescriptor(this.Settings) { Model = new EdmModel().Fixup(), ExpectedException = new TaupoNotSupportedException("Asynchronous metadata writing is not supported.") }, RunInAsync = true, }, new MetadataWriterErrorTestCase { TestDescriptor = new MetadataWriterTestDescriptor(this.Settings) { Model = new EdmModel().Fixup(), ExpectedODataExceptionMessage = "A metadata document cannot be written to request payloads. Metadata documents are only supported in responses.", }, RunInRequest = true, }, }; var allTestCases = testCases.Concat(manualTestCases); this.CombinatorialEngineProvider.RunCombinations( allTestCases, this.WriterTestConfigurationProvider.DefaultFormatConfigurationsWithIndent, (testCase, testConfiguration) => { if (testCase.RunInAsync == testConfiguration.Synchronous) { return; } if (testCase.RunInRequest != testConfiguration.IsRequest) { return; } testCase.TestDescriptor.RunTest(testConfiguration, this.Logger); }); }
public void MetadataDocumentWriterErrorTest() { MetadataWriterTestDescriptor[] errorDescriptors = new MetadataWriterTestDescriptor[] { // EdmLib writes entity types without key //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.EntityTypeWithoutKey, // ExpectedODataExceptionMessage = "foo", //}, // EdmLib writes duplicate types and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.DuplicateEntityTypes, // ExpectedODataExceptionMessage = "foo2", //}, // EdmLib writes duplicate types and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.DuplicateComplexTypes, // ExpectedODataExceptionMessage = "foo3", //}, // EdmLib writes duplicate properties and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.ComplexTypeWithDuplicateProperties, // ExpectedODataExceptionMessage = "foo4", //}, // EdmLib writes duplicate properties and test infrastructure can't handle them //new MetadataWriterTestDescriptor(this.Settings) //{ // PayloadModel = TestModels.InvalidModels.EntityTypeWithDuplicateProperties, // ExpectedODataExceptionMessage = "foo5", //}, }; IEnumerable<MetadataWriterErrorTestCase> testCases = errorDescriptors.Select(desc => new MetadataWriterErrorTestCase { TestDescriptor = desc, }); IEnumerable<MetadataWriterErrorTestCase> manualTestCases = new MetadataWriterErrorTestCase[] { new MetadataWriterErrorTestCase { TestDescriptor = new MetadataWriterTestDescriptor(this.Settings) { Model = new EdmModel().Fixup(), ExpectedException = new TaupoNotSupportedException("Asynchronous metadata writing is not supported.") }, RunInAsync = true, }, new MetadataWriterErrorTestCase { TestDescriptor = new MetadataWriterTestDescriptor(this.Settings) { Model = new EdmModel().Fixup(), ExpectedODataExceptionMessage = "A metadata document cannot be written to request payloads. Metadata documents are only supported in responses.", }, RunInRequest = true, }, }; var allTestCases = testCases.Concat(manualTestCases); this.CombinatorialEngineProvider.RunCombinations( allTestCases, this.WriterTestConfigurationProvider.DefaultFormatConfigurationsWithIndent, (testCase, testConfiguration) => { if (testCase.RunInAsync == testConfiguration.Synchronous) { return; } if (testCase.RunInRequest != testConfiguration.IsRequest) { return; } testCase.TestDescriptor.RunTest(testConfiguration, this.Logger); }); }