Ejemplo n.º 1
0
        public void CreateEntryReaderArgumentTest()
        {
            IEdmEntityType  entityType  = null;
            IEdmComplexType complexType = null;
            IEdmModel       model       = this.CreateTestMetadata(out entityType, out complexType);

            this.CombinatorialEngineProvider.RunCombinations(
                this.ReaderTestConfigurationProvider.ExplicitFormatConfigurations,
                (testConfiguration) =>
            {
                TestMessage message = TestReaderUtils.CreateInputMessageFromStream(new TestStream(), testConfiguration);
                ODataMessageReaderTestWrapper messageReader = TestReaderUtils.CreateMessageReader(message, null, testConfiguration);
                this.Assert.ExpectedException(
                    () => messageReader.CreateODataEntryReader(entityType),
                    ODataExpectedExceptions.ArgumentException("ODataMessageReader_ExpectedTypeSpecifiedWithoutMetadata", "entityType"),
                    this.ExceptionVerifier);
            });
        }
        public void StreamMessage(ODataMessageReaderTestWrapper reader, ODataMessageWriterTestWrapper writer, ODataPayloadKind payloadKind, WriterTestConfiguration config)
        {
            ExceptionUtilities.CheckArgumentNotNull(reader, "reader is required");
            ExceptionUtilities.CheckArgumentNotNull(writer, "writer is required");
            ExceptionUtilities.CheckArgumentNotNull(payloadKind, "payloadKind is required");
            ExceptionUtilities.CheckArgumentNotNull(config, "config is required");

            this.testConfiguration = config;

            switch (payloadKind)
            {
            case ODataPayloadKind.Entry:
                this.StartRead(reader.CreateODataEntryReader(), writer.CreateODataEntryWriter());
                break;

            case ODataPayloadKind.Feed:
                this.StartRead(reader.CreateODataFeedReader(), writer.CreateODataFeedWriter());
                break;

            default:
                throw new NotSupportedException("ObjectModelReadWriteStreamer currently supports only feed and entry");
            }
            ;
        }