コード例 #1
0
        private void VerifyChangeOperationResponse(ChangeOperationResponseData expected, ChangeOperationResponse actual, int responseOrder)
        {
            this.Assert.IsNotNull(actual.Descriptor, GetVerificationFailureMessage(responseOrder, "Change operation response descriptor should not be null!"));
            this.VerifyDescriptor(expected.DescriptorData, actual.Descriptor, responseOrder);

            this.Assert.AreEqual(
                expected.StatusCode,
                actual.StatusCode,
                GetVerificationFailureMessage(responseOrder, "Status code verification failed for the change operation response data: {0}.", expected));

            // No headers verification

            // Verify exceptions
            if (!string.IsNullOrEmpty(expected.ExceptionId))
            {
                throw new TaupoNotSupportedException(
                    string.Format(
                    CultureInfo.InvariantCulture,
                    "Change operation response data with order {0} has non-null exception id '{1}'. This verifier does not support exception verification.",
                    responseOrder,
                    expected.ExceptionId));
            }

            this.Assert.IsNull(actual.Error, GetVerificationFailureMessage(responseOrder, "Unexpected exception thrown:\r\n{0}", actual.Error));

            this.Assert.AreEqual(
                expected.DescriptorData.State.ToProductEnum(),
                actual.Descriptor.State,
                GetVerificationFailureMessage(responseOrder, "Descriptor State verification failed for the change operation response data: {0}.", expected));
        }
コード例 #2
0
            private void UpdateResponse(DataServiceResponseData responseData, DescriptorData descriptor, HttpResponseData response)
            {
                var operationResponse = new ChangeOperationResponseData(descriptor);
                operationResponse.StatusCode = (int)response.StatusCode;
                foreach (var header in response.Headers)
                {
                    operationResponse.Headers.Add(header.Key, header.Value);
                }

                responseData.Add(operationResponse);
            }