Specifies the write access response.
Inheritance: StreamObject
コード例 #1
0
        /// <summary>
        /// Deserialize sub response data from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains sub response data.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        protected override void DeserializeSubResponseDataFromByteArray(byte[] byteArray, ref int currentIndex)
        {
            int index = currentIndex;

            this.ReadAccessResponse  = StreamObject.GetCurrent <ReadAccessResponse>(byteArray, ref index);
            this.WriteAccessResponse = StreamObject.GetCurrent <WriteAccessResponse>(byteArray, ref index);

            currentIndex = index;

            using (BitReader bitReader = new BitReader(byteArray, index))
            {
                int headertype = bitReader.ReadInt32(2);
                if (headertype == 0x2)
                {
                    StreamObjectHeaderStart32bit header = new StreamObjectHeaderStart32bit();
                    header.HeaderType = headertype;
                    header.Compound   = bitReader.ReadInt32(1);
                    int type = bitReader.ReadInt32(14);
                    header.Type   = (StreamObjectTypeHeaderStart)type;
                    header.Length = bitReader.ReadInt32(15);
                    index        += 4;
                    ResponseError responseError = StreamObject.GetCurrent <ResponseError>(byteArray, ref index);
                }

                // If header type is not 16-bit Stream Object Header End
                if (headertype != 0x3)
                {
                    currentIndex = index + 2;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// This method is used to test WriteAccessResponse related adapter requirements.
        /// </summary>
        /// <param name="instance">Specify the instance which need to be verified.</param>
        /// <param name="site">Specify the ITestSite instance.</param>
        public void VerifyWriteAccessResponse(WriteAccessResponse instance, ITestSite site)
        {
            // If the instance is not null and there are no parsing errors, then the WriteAccessResponse related adapter requirements can be directly captured.
            if (null == instance)
            {
                site.Assert.Fail("The instance of type WriteAccessResponse is null due to parsing error or type casting error.");
            }

            // Verify the stream object header related requirements.
            this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site);

            // Capture requirement MS-FSSHTTPB_R591, if the WriteAccessResponse stream object start header is StreamObjectHeaderStart32bit.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(StreamObjectHeaderStart32bit),
                     instance.StreamObjectHeaderStart.GetType(),
                     "MS-FSSHTTPB",
                     591,
                     @"[In Query Access] Write Access Response Start (4 bytes): A 32-bit stream object header that specifies a write access response start.");

            // Directly capture requirement MS-FSSHTTPB_R592, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     592,
                     @"[In Query Access] Response Error (variable): A response error that specifies write access permission.");

            // Directly capture requirement MS-FSSHTTPB_R945, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     945,
                     @"[In Query Access] Response Error (variable): This error[Response Error] is received in response to a Put Changes request made by the client.");

            // Verify the stream object header end related requirements.
            this.ExpectStreamObjectHeaderEnd(instance.StreamObjectHeaderEnd, instance.GetType(), site);
            this.ExpectCompoundObject(instance.StreamObjectHeaderStart, site);

            // Capture requirement MS-FSSHTTPB_R593, if WriteAccessResponse stream object end header is StreamObjectHeaderEnd16bit.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(StreamObjectHeaderEnd16bit),
                     instance.StreamObjectHeaderEnd.GetType(),
                     "MS-FSSHTTPB",
                     593,
                     @"[In Query Access] Write Access Response End (2 bytes): A 16-bit stream object header that specifies a write access response end.");
        }