Microsoft.Protocols.TestSuites.MS_OXCROPS.MS_OXCROPSAdapter.VerifyRopGetOwningServersSuccessResponse C# (CSharp) Method

VerifyRopGetOwningServersSuccessResponse() private method

Verify RopGetOwningServers Success Response
private VerifyRopGetOwningServersSuccessResponse ( RopGetOwningServersResponse ropGetOwningServerResponse, byte inputHandleIndex ) : void
ropGetOwningServerResponse RopGetOwningServersResponse The success response of RopGetOwningServers request
inputHandleIndex byte The field of InputHandleIndex in RopGetOwningServers request
return void
        private void VerifyRopGetOwningServersSuccessResponse(RopGetOwningServersResponse ropGetOwningServerResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R262");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R262
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropGetOwningServerResponse.RopId.GetType(),
                262,
                @"[In RopGetOwningServers ROP Success Response Buffer] RopId (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R264");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R264
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopGetOwningServers,
                ropGetOwningServerResponse.RopId,
                264,
                @"[In RopGetOwningServers ROP Success Response Buffer] RopId (1 byte): For this operation[RopGetOwningServers], this field[RopId (1 byte)] is set to 0x42.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R265");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R265
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropGetOwningServerResponse.InputHandleIndex.GetType(),
                265,
                @"[In RopGetOwningServers ROP Success Response Buffer] InputHandleIndex (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R266");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R266
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropGetOwningServerResponse.InputHandleIndex,
                266,
                @"[In RopGetOwningServers ROP Success Response Buffer] InputHandleIndex (1 byte): This index MUST be set to the value specified in the InputHandleIndex field in the request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R267");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R267
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropGetOwningServerResponse.ReturnValue.GetType(),
                267,
                @"[In RopGetOwningServers ROP Success Response Buffer] ReturnValue (4 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R269");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R269
            Site.CaptureRequirementIfAreEqual<uint>(
                SuccessReturnValue,
                ropGetOwningServerResponse.ReturnValue,
                269,
                @"[In RopGetOwningServers ROP Success Response Buffer] ReturnValue (4 bytes): For this response[Success Response Buffer], this field[ReturnValue (4 bytes)] is set to 0x00000000.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R270");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R270
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ushort),
                ropGetOwningServerResponse.OwningServersCount.GetType(),
                270,
                @"[In RopGetOwningServers ROP Success Response Buffer] OwningServersCount (2 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R272");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R272
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ushort),
                ropGetOwningServerResponse.CheapServersCount.GetType(),
                272,
                @"[In RopGetOwningServers ROP Success Response Buffer] CheapServersCount (2 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R274,the length of the OwningServers is {0}", ropGetOwningServerResponse.OwningServers.Length);

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R274
            // Assume the result is true. If one of List is not null-terminated ASCII string, then false.
            bool isVerifyR274 = true;
            foreach (string service in ropGetOwningServerResponse.OwningServers)
            {
                byte[] buffer = Encoding.ASCII.GetBytes(service);
                isVerifyR274 = isVerifyR274 && this.IsNullTerminatedASCIIStr(buffer);

                // If one of List is not null-terminated ASCII string then break iteration
                if (!isVerifyR274)
                {
                    break;
                }
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifyR274,
                274,
                @"[In RopGetOwningServers ROP Success Response Buffer] OwningServers (variable):A list of null-terminated ASCII strings.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R275");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R275
            Site.CaptureRequirementIfAreEqual<ushort>(
                ropGetOwningServerResponse.OwningServersCount,
                (ushort)ropGetOwningServerResponse.OwningServers.Length,
                275,
                @"[In RopGetOwningServers ROP Success Response Buffer] OwningServers (variable): The number of strings contained in this field is specified by the OwningServersCount field.");
        }
MS_OXCROPSAdapter