/// <summary> /// Capture requirements related with SubResponseType /// </summary> /// <param name="subResponse">The SubResponseType information</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateSubResponseType(SubResponseType subResponse, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R281 site.CaptureRequirement( "MS-FSSHTTP", 281, @"[In SubResponseType][SubResponseType schema is:] <xs:complexType name=""SubResponseType""> <xs:attribute name=""SubRequestToken"" type=""xs:nonNegativeInteger"" use=""required""/> <xs:attribute name=""ErrorCode"" type=""tns:ErrorCodeTypes"" use=""required"" /> <xs:attribute name=""HResult"" type=""xs:integer"" use=""required"" fixed=""0""/> <xs:attribute name=""ErrorMessage"" type=""xs:string"" use=""optional""/> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R284 // If the SubRequestToken attribute isn't null, then capture MS-FSSHTTP_R284. site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R284, the SubRequestToken should be specified, the actual SubRequestToken value is: {0}", subResponse.SubRequestToken != null ? subResponse.SubRequestToken : "NULL"); site.CaptureRequirementIfIsNotNull( subResponse.SubRequestToken, "MS-FSSHTTP", 284, @"[In SubResponseType] The SubRequestToken attribute MUST be specified for a SubResponse element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R290 // If the ErrorCode attribute is not null, capture R290. site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R290, the ErrorCode attribute should be specified, the actual ErrorCode value is: {0}", subResponse.ErrorCode != null ? subResponse.ErrorCode : "NULL"); site.CaptureRequirementIfIsNotNull( subResponse.ErrorCode, "MS-FSSHTTP", 290, @"[In SubResponseType] The ErrorCode attribute MUST be specified for a SubResponse element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1003 site.CaptureRequirementIfIsNotNull( subResponse.ErrorCode, "MS-FSSHTTP", 1003, @"[In Coauth Subrequest][The protocol server returns results based on the following conditions:] Depending on the type of error, ErrorCode is returned as an attribute of the SubResponse element."); if (subResponse.ErrorCode != null) { ErrorCodeType errorCode; site.Assert.IsTrue(Enum.TryParse<ErrorCodeType>(subResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", subResponse.ErrorCode); // Verify requirements related with ErrorCodeTypes ValidateErrorCodeTypes(errorCode, site); } }