コード例 #1
0
        /// <summary>
        /// Runs the test case.
        /// </summary>
        public override void Run()
        {
            BatchReaderStreamBufferWrapper  streamBuffer   = new BatchReaderStreamBufferWrapper();
            MemoryStreamBatchPayloadBuilder payloadBuilder = new MemoryStreamBatchPayloadBuilder(this.Encoding, this.LineFeedChars);

            // If no explicit payload func was specified, use a default payload
            MemoryStream memoryStream;

            if (this.PayloadFunc == null)
            {
                memoryStream = payloadBuilder.FillBytes(BatchReaderStreamBufferWrapper.BufferLength).ResetMemoryStream();
            }
            else
            {
                memoryStream = this.PayloadFunc(payloadBuilder);
            }

            // Create a message reader and then a batch reader for the message
            using (ODataMessageReader messageReader = this.CreateMessageReader(memoryStream))
            {
                ODataBatchReader         batchReader   = messageReader.CreateODataBatchReader();
                BatchReaderStreamWrapper streamWrapper = new BatchReaderStreamWrapper(batchReader);

                Exception exception = TestExceptionUtils.RunCatching(() =>
                {
                    this.RunTestAction(streamWrapper);
                });

                this.VerifyException(exception);
            }
        }
コード例 #2
0
        /// <summary>
        /// Runs the test case.
        /// </summary>
        public override void Run()
        {
            BatchReaderStreamBufferWrapper streamBuffer = new BatchReaderStreamBufferWrapper();
            MemoryStreamBatchPayloadBuilder payloadBuilder = new MemoryStreamBatchPayloadBuilder(this.Encoding, this.LineFeedChars);

            // If no explicit payload func was specified, use a default payload
            MemoryStream memoryStream;
            if (this.PayloadFunc == null)
            {
                memoryStream = payloadBuilder.FillBytes(BatchReaderStreamBufferWrapper.BufferLength).ResetMemoryStream();
            }
            else
            {
                memoryStream = this.PayloadFunc(payloadBuilder);
            }

            // Create a message reader and then a batch reader for the message
            using (ODataMessageReader messageReader = this.CreateMessageReader(memoryStream))
            {
                ODataBatchReader batchReader = messageReader.CreateODataBatchReader();
                BatchReaderStreamWrapper streamWrapper = new BatchReaderStreamWrapper(batchReader);

                Exception exception = TestExceptionUtils.RunCatching(() =>
                {
                    this.RunTestAction(streamWrapper);
                });

                this.VerifyException(exception);
            }
        }
コード例 #3
0
        /// <summary>
        /// Runs the test case.
        /// </summary>
        public override void Run()
        {
            BatchReaderStreamBufferWrapper streamBuffer = new BatchReaderStreamBufferWrapper();
            MemoryStreamBatchPayloadBuilder payloadBuilder = new MemoryStreamBatchPayloadBuilder(this.Encoding, this.LineFeedChars);

            // If no explicit payload func was specified, use a default payload
            MemoryStream memoryStream;
            if (this.PayloadFunc == null)
            {
                memoryStream = payloadBuilder.FillBytes(BatchReaderStreamBufferWrapper.BufferLength).ResetMemoryStream();
            }
            else
            {
                memoryStream = this.PayloadFunc(payloadBuilder);
            }

            Exception exception = TestExceptionUtils.RunCatching(() =>
            {
                this.RunTestAction(streamBuffer, memoryStream);
            });

            this.VerifyException(exception);
        }
コード例 #4
0
        /// <summary>
        /// Runs the test case.
        /// </summary>
        public override void Run()
        {
            BatchReaderStreamBufferWrapper  streamBuffer   = new BatchReaderStreamBufferWrapper();
            MemoryStreamBatchPayloadBuilder payloadBuilder = new MemoryStreamBatchPayloadBuilder(this.Encoding, this.LineFeedChars);

            // If no explicit payload func was specified, use a default payload
            MemoryStream memoryStream;

            if (this.PayloadFunc == null)
            {
                memoryStream = payloadBuilder.FillBytes(BatchReaderStreamBufferWrapper.BufferLength).ResetMemoryStream();
            }
            else
            {
                memoryStream = this.PayloadFunc(payloadBuilder);
            }

            Exception exception = TestExceptionUtils.RunCatching(() =>
            {
                this.RunTestAction(streamBuffer, memoryStream);
            });

            this.VerifyException(exception);
        }