コード例 #1
0
        /// <summary>
        /// Writes the payload to the stream using the given callback, then verifies the payload using the test deserializer
        /// </summary>
        /// <param name="originalPayload">The payload being tested, of which a copy will be made</param>
        /// <param name="message">The stream to write to</param>
        /// <param name="odataVersion">The OData protocol version to be used for writing payloads.</param>
        /// <param name="format">The current format</param>
        /// <param name="writeToStream">The callback to write to the stream</param>
        private void WriteAndLogODataPayload(ODataPayloadElement originalPayload, TestMessage message, ODataVersion odataVersion, ODataFormat format, Action <ODataPayloadElement> writeToStream)
        {
            ExceptionUtilities.CheckArgumentNotNull(originalPayload, "originalPayload");
            ExceptionUtilities.CheckArgumentNotNull(writeToStream, "writeToStream");

            // This is needed because we may modify the payload in use but the same is used in another iteration of the combinatorial engine
            var payload = originalPayload.DeepCopy();

            WriteToStream(format, writeToStream, payload);
            var newPayload = TestWriterUtils.ReadToString(message);

            this.Logger.LogPayload(newPayload);
        }
コード例 #2
0
        /// <summary>
        /// Verifies that the result of the test is what the test expected.
        /// </summary>
        /// <param name="stream">The stream after writing the message content. This method should use it
        /// to read the message content and verify it.</param>
        /// <param name="payloadKind">The payload kind specified in the test descriptor.</param>
        /// <param name="testConfiguration">The test configuration to use.</param>
        public override void VerifyResult(
            TestMessage message,
            ODataPayloadKind payloadKind,
            WriterTestConfiguration testConfiguration,
            BaselineLogger logger)
        {
            // Get observed payload
            var observed = TestWriterUtils.ReadToString(message);

            if (logger != null)
            {
                logger.LogPayload(TestWriterUtils.BaseLineFixup(observed));
            }
        }
コード例 #3
0
        /// <summary>
        /// Verifies that the result of the test is what the test expected.
        /// </summary>
        /// <param name="stream">The stream after writing the message content. This method should use it
        /// to read the message content and verify it.</param>
        /// <param name="payloadKind">The payload kind specified in the test descriptor.</param>
        /// <param name="testConfiguration">The test configuration to use.</param>
        public override void VerifyResult(
            TestMessage message,
            ODataPayloadKind payloadKind,
            WriterTestConfiguration testConfiguration,
            BaselineLogger logger)
        {
            this.settings.Assert.IsTrue(payloadKind == ODataPayloadKind.MetadataDocument, "Only metadata payload kind is supported.");

            // read the message content using the Taupo infrastructure
            ExceptionUtilities.CheckArgumentNotNull(message.TestStream, "stream != null");
            var observed = TestWriterUtils.ReadToString(message);

            if (logger != null)
            {
                logger.LogPayload(TestWriterUtils.BaseLineFixup(observed));
            }
        }