本文整理汇总了C#中ITestSite.CaptureRequirementIfIsTrue方法的典型用法代码示例。如果您正苦于以下问题:C# ITestSite.CaptureRequirementIfIsTrue方法的具体用法?C# ITestSite.CaptureRequirementIfIsTrue怎么用?C# ITestSite.CaptureRequirementIfIsTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITestSite
的用法示例。
在下文中一共展示了ITestSite.CaptureRequirementIfIsTrue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaptureScopesElementRequirements
/// <summary>
/// Capture requirements for Scope structure
/// </summary>
/// <param name="scopes">Scope structure</param>
/// <param name="site">A instance of ITestSite.</param>
public static void CaptureScopesElementRequirements(ScopesType scopes, ITestSite site)
{
// Add debug info
site.Log.Add(LogEntryKind.Debug, "Scopes: {0}", scopes);
site.CaptureRequirementIfIsNotNull(
scopes,
55,
@"[In Scopes] Each element in the list is actually a UTF-8-encoded string representation of
the HoHoDk value in hexBinary format [XMLSCHEMA1.1/2] [and represents one segment].");
// Add debug info
site.Log.Add(LogEntryKind.Debug, "Scopes: {0}", scopes);
site.CaptureRequirementIfIsTrue(
scopes.Text.Length > 0,
158,
@"[The <Scopes> element represents the list of discovery provider scopes, where]
each element in the list is a string.");
}
示例2: VerifyResponseError
/// <summary>
/// This method is used to test Response Error 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 VerifyResponseError(ResponseError instance, ITestSite site)
{
// If the instance is not null and there are no parsing errors, then the Response Error related adapter requirements can be directly captured.
if (null == instance)
{
site.Assert.Fail("The instance of type ResponseError is null due to parsing error or type casting error.");
}
// Verify the stream object header related requirements.
this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site);
// Directly capture requirement MS-FSSHTTPB_R617, if the stream object header is StreamObjectHeaderStart32bit.
site.CaptureRequirementIfAreEqual<Type>(
typeof(StreamObjectHeaderStart32bit),
instance.StreamObjectHeaderStart.GetType(),
"MS-FSSHTTPB",
617,
@"[In Response Error] Error Start (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies an error start.");
// Directly capture requirement MS-FSSHTTPB_R618, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
618,
@"[In Response Error] Error Type GUID (16 bytes): A GUID that specifies the error type.");
bool responseErrorFlag = instance.ErrorTypeGUID == new Guid(ResponseError.CellErrorGuid)
|| instance.ErrorTypeGUID == new Guid(ResponseError.ProtocolErrorGuid)
|| instance.ErrorTypeGUID == new Guid(ResponseError.Win32ErrorGuid)
|| instance.ErrorTypeGUID == new Guid(ResponseError.HresultErrorGuid);
site.Assert.IsTrue(
responseErrorFlag,
"Actual the error type guid {0}, which should be either 5A66A756-87CE-4290-A38B-C61C5BA05A67,7AFEAEBF-033D-4828-9C31-3977AFE58249, 32C39011-6E39-46C4-AB78-DB41929D679E or 8454C8F2-E401-405A-A198-A10B6991B56E for requirement MS-FSSHTTPB_R619",
instance.ErrorTypeGUID.ToString());
// Directly capture requirement MS-FSSHTTPB_R619, if the responseErrorFlag is true;
site.CaptureRequirementIfIsTrue(
responseErrorFlag,
"MS-FSSHTTPB",
619,
@"[In Response Error] Error Type GUID (16 bytes): The following table contains the possible values for the error type: [the value of the Error Type GUID field must be {5A66A756-87CE-4290-A38B-C61C5BA05A67},{7AFEAEBF-033D-4828-9C31-3977AFE58249}, {32C39011-6E39-46C4-AB78-DB41929D679E}, {8454C8F2-E401-405A-A198-A10B6991B56E}.");
switch (instance.ErrorTypeGUID.ToString("D").ToUpper(CultureInfo.CurrentCulture))
{
case ResponseError.CellErrorGuid:
// Capture requirement MS-FSSHTTPB_R620, if the error data type is CellError.
site.CaptureRequirementIfAreEqual<Type>(
typeof(CellError),
instance.ErrorData.GetType(),
"MS-FSSHTTPB",
620,
@"[In Response Error] Error Type GUID field is set to {5A66A756-87CE-4290-A38B-C61C5BA05A67}[ specifies the error type is ]Cell error (section 2.2.3.2.1).");
break;
case ResponseError.ProtocolErrorGuid:
// All the serial number null values related requirements can be located here.
site.Log.Add(LogEntryKind.Debug, "Runs for ProtocolErrorGuid verification logic with the error code {0}.", instance.ErrorData.ErrorDetail);
break;
case ResponseError.Win32ErrorGuid:
// Capture requirement MS-FSSHTTPB_R622, if the error data type is Win32 error.
site.CaptureRequirementIfAreEqual<Type>(
typeof(Win32Error),
instance.ErrorData.GetType(),
"MS-FSSHTTPB",
622,
@"[In Response Error] Error Type GUID field is set to {32C39011-6E39-46C4-AB78-DB41929D679E}[ specifies the error type is ]Win32 error (section 2.2.3.2.3).");
break;
case ResponseError.HresultErrorGuid:
// Capture requirement MS-FSSHTTPB_R623, if the error data type is HRESULTError.
site.CaptureRequirementIfAreEqual<Type>(
typeof(HRESULTError),
instance.ErrorData.GetType(),
"MS-FSSHTTPB",
623,
@"[In Response Error] Error Type GUID field is set to {8454C8F2-E401-405A-A198-A10B6991B56E}[ specifies the error type is ]HRESULT error (section 2.2.3.2.4).");
break;
default:
site.Assert.Fail("Unsupported error type GUID " + instance.ErrorTypeGUID.ToString());
break;
}
// Directly capture requirement MS-FSSHTTPB_R625, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
625,
//.........这里部分代码省略.........
示例3: VerifyAllocateExtendedGuidRangeSubResponseData
/// <summary>
/// This method is used to test Allocate ExtendedGuid Range 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 VerifyAllocateExtendedGuidRangeSubResponseData(AllocateExtendedGuidRangeSubResponseData instance, ITestSite site)
{
// If the instance is not null and there are no parsing errors, then the Allocate ExtendedGuid Range related adapter requirements can be directly captured.
if (null == instance)
{
site.Assert.Fail("The instance of type AllocateExtendedGuidRangeSubResponseData is null due to parsing error or type casting error.");
}
// Verify the stream object header related requirements.
this.ExpectStreamObjectHeaderStart(instance.AllocateExtendedGUIDRangeResponse, instance.GetType(), site);
// Directly capture requirement MS-FSSHTTPB_R2203, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
2203,
@"[In Allocate ExtendedGuid Range] Allocate ExtendedGuid Range Response (4 bytes): A stream object header (section 2.2.1.5) that specifies an allocate extendedGUID range response.");
// Directly capture requirement MS-FSSHTTPB_R2204, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
2204,
@"[In Allocate ExtendedGuid Range] GUID Component (16 bytes): A GUID that specifies the GUID portion of the reserved extended GUIDs (section 2.2.1.7).");
// Directly capture requirement MS-FSSHTTPB_R2205, if there are no parsing errors.
// This requirement is partially captured, only the type "A compact unsigned 64-bit integer" can be captured.
site.CaptureRequirement(
"MS-FSSHTTPB",
2205,
@"[In Allocate ExtendedGuid Range] Integer Range Min (variable): A compact unsigned 64-bit integer (section 2.2.1.1) that specifies the first integer element in the range of extended GUIDs.");
// Directly capture requirement MS-FSSHTTPB_R2206, if there are no parsing errors.
// This requirement is partially captured, only the type "A compact unsigned 64-bit integer" can be captured.
site.CaptureRequirement(
"MS-FSSHTTPB",
2206,
@"[In Allocate ExtendedGuid Range] [Integer Range Max (variable)] specifies the last + 1 integer element in the range of extended GUIDs.");
bool isVerifiedR99062 = instance.IntegerRangeMax.DecodedValue >= 1000 && instance.IntegerRangeMax.DecodedValue <= 100000;
site.Log.Add(
LogEntryKind.Debug,
"The Integer Range Max should be in the range 1000 and 100000, its actual value is {0}",
instance.IntegerRangeMax.DecodedValue);
site.CaptureRequirementIfIsTrue(
isVerifiedR99062,
"MS-FSSHTTPB",
99062,
@"[In Allocate ExtendedGuid Range] Integer Range Max (variable): A compact unsigned 64-bit integer with a minimum allowed value of 1000 and maximum allowed value of 100000.");
// Verify the compound related requirements.
this.ExpectSingleObject(instance.AllocateExtendedGUIDRangeResponse, site);
}
示例4: ValidateCoauthSubResponse
/// <summary>
/// Capture requirements related to coauthoring sub response.
/// </summary>
/// <param name="coauthSubResponse">The coauthoring response.</param>
/// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
public static void ValidateCoauthSubResponse(CoauthSubResponseType coauthSubResponse, ITestSite site)
{
ValidateSubResponseType(coauthSubResponse as SubResponseType, site);
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4687
// if can launch this method, the schema matches.
site.CaptureRequirementIfAreEqual<Type>(
typeof(CoauthSubResponseType),
coauthSubResponse.GetType(),
"MS-FSSHTTP",
4687,
@"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: CoauthSubResponseType.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5742
// if can launch this method, the schema matches.
site.CaptureRequirementIfAreEqual<Type>(
typeof(CoauthSubResponseType),
coauthSubResponse.GetType(),
"MS-FSSHTTP",
5742,
@"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: CoauthSubResponseType.");
if (string.Compare("Success", coauthSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0)
{
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1496
bool isVerifyR1496 = coauthSubResponse.SubResponseData != null;
// If the coauthSubResponse.SubResponseData is null, the case run fail.
site.Assert.IsTrue(
isVerifyR1496,
"For requirement MS-FSSHTTP_R1496, the SubResponseData should not be NULL.");
// if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message,
// so this requirement can be captured.
site.CaptureRequirement(
"MS-FSSHTTP",
1496,
@"[In CoauthSubResponseType] As part of processing the coauthoring subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true:
The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "Verify MS-FSSHTTP_R267:the returned SubResponseData is {0}", coauthSubResponse.SubResponseData.ToString());
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R267
// if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message,
// so this requirement can be captured.
bool isVerifyR267 = coauthSubResponse.SubResponseData != null;
site.CaptureRequirementIfIsTrue(
isVerifyR267,
"MS-FSSHTTP",
267,
@"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""Coauth"".");
}
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R624
// If the coauthoring subResponse exists,its schema will have been validated before invoking the method CaptureJoinCoauthoringSessionRelatedRequirements.
// So MS-FSSHTTP_R624 can be captured.
site.CaptureRequirement(
"MS-FSSHTTP",
624,
@"[In CoauthSubResponseType][CoauthSubResponseType schema is:]
<xs:complexType name=""CoauthSubResponseType"">
<xs:complexContent>
<xs:extension base=""tns:SubResponseType"">
<xs:sequence minOccurs=""0"" maxOccurs=""1"">
<xs:element name=""SubResponseData"" type=""tns:CoauthSubResponseDataType"" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R984
// Since the subResponse is of type CoauthSubResponseType, so this requirement can be captured.
site.CaptureRequirementIfAreEqual<Type>(
typeof(CoauthSubResponseType),
coauthSubResponse.GetType(),
"MS-FSSHTTP",
984,
@"[In Coauth Subrequest][The protocol client sends a coauthoring SubRequest message, which is of type CoauthSubRequestType,] The protocol server responds with a coauthoring SubResponse message, which is of type CoauthSubResponseType as specified in section 2.3.1.8.");
if (coauthSubResponse.SubResponseData != null)
{
ValidateCoauthSubResponseDataType(coauthSubResponse.SubResponseData, site);
}
}
示例5: VerifyObjectGroupObjectDataForDataNodeObject
/// <summary>
/// Verify ObjectGroupObjectData for the DataNodeObject related requirements.
/// </summary>
/// <param name="objectGroupObjectData">Specify the objectGroupObjectData instance.</param>
/// <param name="dataNodeDeclare">Specify the data node object declare instance.</param>
/// <param name="objectGroupList">Specify all the ObjectGroupDataElementData list.</param>
/// <param name="site">Specify the ITestSite instance.</param>
public static void VerifyObjectGroupObjectDataForDataNodeObject(ObjectGroupObjectData objectGroupObjectData, ObjectGroupObjectDeclare dataNodeDeclare, List<ObjectGroupDataElementData> objectGroupList, ITestSite site)
{
#region Verify the Object Group Object Data
// Object Extended GUID Array : Specifies an ordered list of the Object Extended GUIDs for each child of the Root Node.
ExGUIDArray childObjectExGuidArray = objectGroupObjectData.ObjectExGUIDArray;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", childObjectExGuidArray.Count.DecodedValue);
// If the Object Extended GUID Array is an empty list, indicates that the count of the array is 0.
// So capture these requirements.
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R3
site.CaptureRequirementIfAreEqual<ulong>(
0,
childObjectExGuidArray.Count.DecodedValue,
"MS-FSSHTTPD",
3,
@"[In Common Node Object Properties][Data of Object Extended GUID Array field] Specifies an empty list of Object Extended GUIDs.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R71
site.CaptureRequirementIfAreEqual<ulong>(
0,
childObjectExGuidArray.Count.DecodedValue,
"MS-FSSHTTPD",
71,
@"[In Data Node Object References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Data Node Object MUST specify an empty array.");
// Cell ID Array : Specifies an empty list of Cell IDs.
CellIDArray cellIDArray = objectGroupObjectData.CellIDArray;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", cellIDArray.Count);
// If the Object Extended GUID Array is an empty list, indicates that the count of the array is 0.
// So capture these requirements.
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R6
site.CaptureRequirementIfAreEqual<ulong>(
0,
cellIDArray.Count,
"MS-FSSHTTPD",
6,
@"[In Common Node Object Properties][Data of Cell ID Array field] Specifies an empty list of Cell IDs.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R72
site.CaptureRequirementIfAreEqual<ulong>(
0,
cellIDArray.Count,
"MS-FSSHTTPD",
72,
@"[In Data Node Object Cell References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Data Node Object MUST specify an empty array.");
#endregion
#region Verify the Object Group Object Declaration
// Object Extended GUID : An extended GUID which specifies an identifier for this object. This GUID MUST be unique within this file.
ExGuid currentObjectExGuid = dataNodeDeclare.ObjectExtendedGUID;
// Check whether Object Extended GUID is unique.
bool isUnique = IsGuidUnique(currentObjectExGuid, objectGroupList);
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isUnique);
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8103
site.CaptureRequirementIfIsTrue(
isUnique,
"MS-FSSHTTPD",
8103,
@"[In Common Node Object Properties][Data of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8103
site.CaptureRequirementIfIsTrue(
isUnique,
"MS-FSSHTTPD",
8103,
@"[In Common Node Object Properties][Data of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response.");
// Object Partition ID : A compact unsigned 64-bit integer which MUST be 1.
Compact64bitInt objectPartitionID = dataNodeDeclare.ObjectPartitionID;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The value of Object Partition ID is:{0}", objectPartitionID.DecodedValue);
site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectPartitionID.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer.");
site.Assert.IsTrue(objectPartitionID.DecodedValue == 1, "The actual value of objectPartitionID should be 1.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R19
site.CaptureRequirement(
"MS-FSSHTTPD",
19,
@"[In Common Node Object Properties][Data of Object Partition ID field] A compact unsigned 64-bit integer that MUST be ""1"".");
//.........这里部分代码省略.........
示例6: VerifyObjectGroupObjectDataForIntermediateNode
/// <summary>
/// Verify ObjectGroupObjectData for the Intermediate node object group related requirements.
/// </summary>
/// <param name="objectGroupObjectData">Specify the objectGroupObjectData instance.</param>
/// <param name="intermediateDeclare">Specify the intermediate declare instance.</param>
/// <param name="objectGroupList">Specify all the ObjectGroupDataElementData list.</param>
/// <param name="site">Specify the ITestSite instance.</param>
public static void VerifyObjectGroupObjectDataForIntermediateNode(ObjectGroupObjectData objectGroupObjectData, ObjectGroupObjectDeclare intermediateDeclare, List<ObjectGroupDataElementData> objectGroupList, ITestSite site)
{
#region Verify the Object Group Object Data
ExGUIDArray childObjectExGuidArray = objectGroupObjectData.ObjectExGUIDArray;
if (childObjectExGuidArray != null && childObjectExGuidArray.Count.DecodedValue != 0)
{
// If the intermediate node can be build then verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R65
site.CaptureRequirement(
"MS-FSSHTTPD",
65,
@"[In Intermediate Node Object References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Intermediate Node Object MUST specify an ordered set of Object Extended GUIDs.");
// If the intermediate node can be build then verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8007 and MS-FSSHTTPD_R8008
site.CaptureRequirement(
"MS-FSSHTTPD",
8007,
@"[In Common Node Object Properties][Intermediate of Object Extended GUID Array field] Specifies an ordered list of the Object Extended GUIDs for each child of this Node.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8008
site.CaptureRequirement(
"MS-FSSHTTPD",
8008,
@"[In Common Node Object Properties][Intermediate of Object Extended GUID Array field] Object Extended GUID Array entries MUST be ordered based on the sequential file bytes represented by each Node Object.");
}
// Cell ID Array : Specifies an empty list of Cell IDs.
CellIDArray cellIDArray = objectGroupObjectData.CellIDArray;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", cellIDArray.Count);
// If the Cell ID Array is an empty list, indicates that the count of the array is 0.
// So capture these requirements.
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R5
site.CaptureRequirementIfAreEqual<ulong>(
0,
cellIDArray.Count,
"MS-FSSHTTPD",
5,
@"[In Common Node Object Properties][Intermediate of Cell ID Array field] Specifies an empty list of Cell IDs.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R67
site.CaptureRequirementIfAreEqual<ulong>(
0,
cellIDArray.Count,
"MS-FSSHTTPD",
67,
@"[In Intermediate Node Object Cell References] The Cell Reference Array of the Object MUST specify an empty array.");
#endregion
#region Verify the Object Group Object Declaration
// Object Extended GUID : An extended GUID which specifies an identifier for this object. This GUID MUST be unique within this file.
ExGuid currentObjectExGuid = intermediateDeclare.ObjectExtendedGUID;
// Check whether Object Extended GUID is unique.
bool isVerify8102 = IsGuidUnique(currentObjectExGuid, objectGroupList);
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isVerify8102);
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8102
site.CaptureRequirementIfIsTrue(
isVerify8102,
"MS-FSSHTTPD",
8102,
@"[In Common Node Object Properties][Intermediate of Object Extended GUID Field] This GUID[Object Extended GUID] MUST be different within this file in once response.");
// Object Partition ID : A compact unsigned 64-bit integer which MUST be 1.
Compact64bitInt objectPartitionID = intermediateDeclare.ObjectPartitionID;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The value of Object Partition ID is:{0}", objectPartitionID.DecodedValue);
site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectPartitionID.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer.");
site.Assert.IsTrue(objectPartitionID.DecodedValue == 1, "The actual value of objectPartitionID should be 1.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R18
site.CaptureRequirement(
"MS-FSSHTTPD",
18,
@"[In Common Node Object Properties][Intermediate of Object Partition ID field] A compact unsigned 64-bit integer that MUST be ""1"".");
// Object Data Size :A compact unsigned 64-bit integer which MUST be the size of the Object Data field.
Compact64bitInt objectDataSize = intermediateDeclare.ObjectDataSize;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The value of Object Data Size is:{0}", objectDataSize.DecodedValue);
site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectDataSize.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer.");
//.........这里部分代码省略.........
示例7: VerifyObjectGroupObjectDataForRootNode
/// <summary>
/// Verify ObjectGroupObjectData for the Root node object group related requirements.
/// </summary>
/// <param name="objectGroupObjectData">Specify the objectGroupObjectData instance.</param>
/// <param name="rootDeclare">Specify the root declare instance.</param>
/// <param name="objectGroupList">Specify all the ObjectGroupDataElementData list.</param>
/// <param name="site">Specify the ITestSite instance.</param>
public static void VerifyObjectGroupObjectDataForRootNode(ObjectGroupObjectData objectGroupObjectData, ObjectGroupObjectDeclare rootDeclare, List<ObjectGroupDataElementData> objectGroupList, ITestSite site)
{
#region Verify the Object Group Object Data
// Object Extended GUID Array : Specifies an ordered list of the Object Extended GUIDs for each child of the Root Node.
ExGUIDArray childObjectExGuidArray = objectGroupObjectData.ObjectExGUIDArray;
if (childObjectExGuidArray != null && childObjectExGuidArray.Count.DecodedValue != 0)
{
// Run here successfully, then capture the requirement MS-FSSHTTPD_R8009, MS-FSSHTTPD_R8005 and MS-FSSHTTPD_R8006.
site.CaptureRequirement(
"MS-FSSHTTPD",
8005,
@"[In Common Node Object Properties][Root of Object Extended GUID Array field] Specifies an ordered list of the Object Extended GUIDs for each child of the Root Node. ");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8006
site.CaptureRequirement(
"MS-FSSHTTPD",
8006,
@"[In Common Node Object Properties][Root of Object Extended GUID Array field] Object Extended GUID Array entries MUST be ordered based on the sequential file bytes represented by each Node Object.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8009
site.CaptureRequirement(
"MS-FSSHTTPD",
8009,
@"[In Common Node Object Properties][Root of Object Extended GUID field] An extended GUID, as specified in [MS-FSSHTTPB] section 2.2.1.7.");
foreach (ExGuid guid in childObjectExGuidArray.Content)
{
bool isUnique = IsGuidUnique(guid, objectGroupList);
site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isUnique);
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8101
site.CaptureRequirementIfIsTrue(
isUnique,
"MS-FSSHTTPD",
8101,
@"[In Common Node Object Properties][Root of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response.");
}
}
// Cell ID Array : Specifies an empty list of Cell IDs.
CellIDArray cellIDArray = objectGroupObjectData.CellIDArray;
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", cellIDArray.Count);
// If the Cell ID Array is an empty list, indicates that the count of the array is 0.
// So capture these requirements.
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R4
site.CaptureRequirementIfAreEqual<ulong>(
0,
cellIDArray.Count,
"MS-FSSHTTPD",
4,
@"[In Common Node Object Properties][Root of Cell ID Array field] Specifies an empty list of Cell IDs.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R50
site.CaptureRequirementIfAreEqual<ulong>(
0,
cellIDArray.Count,
"MS-FSSHTTPD",
50,
@"[In Root Node Object Cell References] The Cell ID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Root Node Object MUST specify an empty array.");
#endregion
#region Verify the Object Group Object Declaration
// Object Extended GUID : An extended GUID which specifies an identifier for this object. This GUID MUST be unique within this file.
ExGuid currentObjectExGuid = rootDeclare.ObjectExtendedGUID;
// Check whether Object Extended GUID is unique.
bool isGuidUnique = IsGuidUnique(currentObjectExGuid, objectGroupList);
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isGuidUnique);
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8103
site.CaptureRequirementIfIsTrue(
isGuidUnique,
"MS-FSSHTTPD",
8103,
@"[In Common Node Object Properties][Data of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response.");
// Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R75
site.CaptureRequirementIfIsTrue(
isGuidUnique,
"MS-FSSHTTPD",
75,
@"[In Cell Properties] For each stream, a single Root Node MUST be specified by using a unique root identifier.");
// Object Partition ID : A compact unsigned 64-bit integer which MUST be 1.
//.........这里部分代码省略.........
示例8: VerifyObjectCount
/// <summary>
/// This method is used to verify the requirements related with the object count for the root node or intermediate node.
/// </summary>
/// <param name="data">Specify the object data.</param>
/// <param name="site">Specify the ITestSite instance.</param>
public static void VerifyObjectCount(ObjectGroupObjectData data, ITestSite site)
{
RootNodeObject rootNode = null;
int index = 0;
if (data.ObjectExGUIDArray.Count.DecodedValue > 1)
{
bool isRootNode = StreamObject.TryGetCurrent<RootNodeObject>(data.Data.Content.ToArray(), ref index, out rootNode);
site.Log.Add(
TestTools.LogEntryKind.Debug,
"If there are more than one objects in the file, the server will respond the Root Node object for SharePoint Server 2013");
site.CaptureRequirementIfIsTrue(
isRootNode,
"MS-FSSHTTPD",
8202,
@"[In Appendix A: Product Behavior] If there are more than one objects in the file,the implementation does return the Root Node Object. (Microsoft SharePoint Workspace 2010, Microsoft Office 2010 suites/Microsoft SharePoint Server 2010 and above follow this behavior.)");
}
else
{
if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8204, SharedContext.Current.Site))
{
bool isRootNode = StreamObject.TryGetCurrent<RootNodeObject>(data.Data.Content.ToArray(), ref index, out rootNode);
site.Log.Add(
TestTools.LogEntryKind.Debug,
"If there is an only object in the file, the server will respond the Root Node object for SharePoint Server 2013");
site.CaptureRequirementIfIsTrue(
isRootNode,
"MS-FSSHTTPD",
8204,
@"[In Appendix A: Product Behavior] If there is only one object in the file,the implementation does return the Root Node Object. (Microsoft Office 2013/Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Workspace 2010 follow this behavior.)");
}
}
}
示例9: ValidateGetVersionsSubResponse
/// <summary>
/// Capture requirements related to GetVersions sub response.
/// </summary>
/// <param name="getVersionsSubResponse">Containing the getVersionsSubResponse information.</param>
/// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
public static void ValidateGetVersionsSubResponse(GetVersionsSubResponseType getVersionsSubResponse, ITestSite site)
{
ValidateSubResponseType(getVersionsSubResponse as SubResponseType, site);
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694
// if can launch this method, the schema matches
site.CaptureRequirementIfAreEqual<Type>(
typeof(GetVersionsSubResponseType),
getVersionsSubResponse.GetType(),
"MS-FSSHTTP",
4695,
@"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetVersionsSubResponseType.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1816
// if can launch this method, the GetVersionsSubResponseType schema matches.
site.CaptureRequirement(
"MS-FSSHTTP",
1816,
@"[In GetVersionsSubResponseType][The schema of GetVersionsSubResponseType is] <xs:complexType name=""GetVersionsSubResponseType"">
<xs:complexContent>
<xs:extension base=""tns:SubResponseType"">
<xs:sequence minOccurs=""0"" maxOccurs=""1"">
<xs:element ref=""tns:GetVersionsResponse""/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2020
// if can launch this method, the GetVersionsSubResponseType schema matches.
site.CaptureRequirementIfAreEqual<Type>(
typeof(GetVersionsSubResponseType),
getVersionsSubResponse.GetType(),
"MS-FSSHTTP",
2020,
@"[In GetVersions Subrequest][The protocol client sends a GetVersions SubRequest message, which is of type GetVersionsSubRequestType] The protocol server responds with a GetVersions SubResponse message, which is of type GetVersionsSubResponseType as specified in section 2.3.1.32.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2026
// if can launch this method, the GetVersionsSubResponseType schema matches.
site.CaptureRequirement(
"MS-FSSHTTP",
2026,
@"[In GetVersions Subrequest] The Results element, as specified in [MS-VERSS] section 2.2.4.1, is a complex type that specifies information about the file's versions.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301
// If isSchemaValid is true, the GetVersionsSubResponseType schema matches.
site.CaptureRequirement(
"MS-FSSHTTP",
2301,
@"[In GetVersionsSubResponseType][In Results] The DeleteAllVersions, DeleteVersion, GetVersions, and RestoreVersion methods return the Results complex type.
<s:complexType name=""Results"">
<s:sequence>
<s:element name=""list"" maxOccurs=""1"" minOccurs=""1"">
<s:complexType>
<s:attribute name=""id"" type=""s:string"" use=""required"" />
</s:complexType>
</s:element>
<s:element name=""versioning"" maxOccurs=""1"" minOccurs=""1"">
<s:complexType>
<s:attribute name=""enabled"" type=""s:unsignedByte"" use=""required"" />
</s:complexType>
</s:element>
<s:element name=""settings"" maxOccurs=""1"" minOccurs=""1"">
<s:complexType>
<s:attribute name=""url"" type=""s:string"" use=""required"" />
</s:complexType>
</s:element>
<s:element name=""result"" maxOccurs=""unbounded"" minOccurs=""1"" type=""tns:VersionData""/>
</s:sequence>
</s:complexType>");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2303
// Add the log information.
site.Log.Add(LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2303, the versioning.enabled MUST be '0' or '1', the versioning.enabled value is : {0}", getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled.ToString());
// if can launch this method and the versioning.enabled schema matches and value must be 0 or 1.
bool isVerifyR2303 = getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 0 || getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 1;
site.CaptureRequirementIfIsTrue(
isVerifyR2303,
"MS-FSSHTTP",
2303,
@"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: The value of this attribute [versioning.enabled] MUST be ""0"" or ""1"".");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2308
// if can launch this method, the versioning.enabled schema matches.
site.CaptureRequirement(
"MS-FSSHTTP",
2308,
@"[In GetVersionsSubResponseType][In VersionData] The VersionData complex type specifies the details about a single version of a file.
<s:complexType name=""VersionData"">
<s:attribute name=""version"" type=""s:string"" use=""required"" />
<s:attribute name=""url"" type=""s:string"" use=""required"" />
<s:attribute name=""created"" type=""s:string"" use=""required"" />
<s:attribute name=""createdRaw"" type=""s:string"" use=""required"" />
<s:attribute name=""createdBy"" type=""s:string"" use=""required"" />
//.........这里部分代码省略.........
示例10: ValidateResponseElement
/// <summary>
/// Capture requirements related with Response element.
/// </summary>
/// <param name="response">The Response information</param>
/// <param name="site">Instance of ITestSite</param>
private static void ValidateResponseElement(Response response, ITestSite site)
{
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R97
site.CaptureRequirement(
"MS-FSSHTTP",
97,
@"[In Response][Response element schema is:]
<xs:element name=""Response"">
<!--Allows for the numbers to be displayed between the SubResponse elements-->
<xs:complexType mixed=""true"">
<xs:sequence minOccurs=""1"" maxOccurs=""unbounded"">
<xs:element name=""SubResponse"" type=""tns:SubResponseElementGenericType"" />
</xs:sequence>
<xs:attribute name=""Url"" type=""xs:string"" use=""required""/>
<xs:attribute name=""RequestToken"" type=""xs:nonNegativeInteger"" use=""required"" />
<xs:attribute name=""HealthScore"" type=""xs:integer"" use=""required""/>
<xs:attribute name=""ErrorCode"" type=""tns:GenericErrorCodeTypes"" use=""optional"" />
<xs:attribute name=""ErrorMessage"" type=""xs:string"" use=""optional""/>
</xs:complexType>
</xs:element>");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R104
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R104, the Url attribute value should be specified, the actual Url value is: {0}",
response.Url != null ? response.Url : "NULL");
site.CaptureRequirementIfIsNotNull(
response.Url,
"MS-FSSHTTP",
104,
@"[In Response] The Url attribute MUST be specified for each Response element.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1482
// The responseElement.SubResponse.Length specifies the number of SubResponse element in Response.
bool isVerifiedR96 = response.SubResponse.Length >= 1;
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R1482, the Response element should contain one or more SubResponse elements, the actual SubResponse elements number is: {0}",
response.SubResponse.Length.ToString());
site.CaptureRequirementIfIsTrue(
isVerifiedR96,
"MS-FSSHTTP",
96,
@"[In Response] Each Response element MUST contain one or more SubResponse elements.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R107
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R263, the RequestToken should be specified, the actual RequestToken value is: {0}",
response.RequestToken != null ? response.RequestToken : "NULL");
site.CaptureRequirementIfIsNotNull(
response.RequestToken,
"MS-FSSHTTP",
107,
@"[In Response] The RequestToken MUST be specified for each Response element.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2076
bool isVerifyR2076 = int.Parse(response.HealthScore) <= 10 && int.Parse(response.HealthScore) >= 0;
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R2076, the HealthScore value should be between 0 and 10, the actual HealthScore value is: {0}",
response.HealthScore);
site.CaptureRequirementIfIsTrue(
isVerifyR2076,
"MS-FSSHTTP",
2076,
@"[In Response] HealthScore: An integer which value is between 0 and 10.");
// Verify requirements related with SubResponse element
if (response.SubResponse != null)
{
foreach (SubResponseElementGenericType subResponse in response.SubResponse)
{
ValidateSubResponseElement(subResponse, site);
}
}
// Verify requirements related with GenericErrorCodeTypes
if (response.ErrorCodeSpecified)
{
ValidateGenericErrorCodeTypes(site);
}
}
示例11: ValidateMinorVersionNumberType
/// <summary>
/// Capture requirements related with MinorVersionNumberType.
/// </summary>
/// <param name="minorVersionNumber">The minor version number</param>
/// <param name="site">Instance of ITestSite</param>
private static void ValidateMinorVersionNumberType(ushort minorVersionNumber, ITestSite site)
{
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R409
site.CaptureRequirement(
"MS-FSSHTTP",
409,
@"[In MinorVersionNumberType][MinorVersionNumberType schema is:]
<xs:simpleType name=""MinorVersionNumberType"">
<xs:restriction base=""xs:unsignedShort"">
<xs:minInclusive value=""0""/>
<xs:maxInclusive value=""2""/>
</xs:restriction>
</xs:simpleType>");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R410
bool isVerifiedR410 = minorVersionNumber == 0 || minorVersionNumber == 2;
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R410, the MinorVersionNumberType value should be 0 or 2, the actual MinorVersionNumberType value is: {0}",
minorVersionNumber.ToString());
site.CaptureRequirementIfIsTrue(
isVerifiedR410,
"MS-FSSHTTP",
410,
@"[In MinorVersionNumberType] The value of MinorVersionNumberType MUST be 0 or 2.");
}
示例12: ValidateResponse
/// <summary>
/// Capture requirements related with Response message
/// </summary>
/// <param name="storageResponse">The storage response information</param>
/// <param name="requestToken">The expected RequestToken</param>
/// <param name="site">Instance of ITestSite</param>
public static void ValidateResponse(CellStorageResponse storageResponse, string requestToken, ITestSite site)
{
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R17
site.CaptureRequirement(
"MS-FSSHTTP",
17,
@"[In Response] The protocol response schema is specified by the following:
<?xml version=""1.0"" encoding=""utf-8""?>
<xs:schema xmlns:tns=""http://schemas.microsoft.com/sharepoint/soap/"" attributeFormDefault=""unqualified"" elementFormDefault=""qualified""
targetNamespace=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:i=""http://www.w3.org/2004/08/xop/include"">
<xs:import namespace=""http://www.w3.org/2004/08/xop/include"" />
<xs:element name=""Envelope"">
<xs:complexType>
<xs:sequence>
<xs:element name=""Body"">
<xs:complexType>
<xs:sequence>
<xs:element ref=""tns:ResponseVersion"" minOccurs=""1"" maxOccurs=""1"" />
<xs:element ref=""tns:ResponseCollection"" minOccurs=""0"" maxOccurs=""1""/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R18
site.CaptureRequirement(
"MS-FSSHTTP",
18,
@"[In Response] The Body element of each SOAP response message MUST contain a ResponseVersion element.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R19
site.CaptureRequirement(
"MS-FSSHTTP",
19,
@"[In Response] [The Body element of each SOAP response message MUST contain] zero or more ResponseCollection elements.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1613
bool isVerifiedR1613 = storageResponse.ResponseVersion != null;
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R1613, [In Messages] Response: The detail element of the protocol response contains a ResponseVersion element, the actual ResponseVersion elements is: {0}",
storageResponse.ResponseVersion != null ? storageResponse.ResponseVersion.ToString() : "NULL");
site.CaptureRequirementIfIsTrue(
isVerifiedR1613,
"MS-FSSHTTP",
1613,
@"[In Messages] Response: The detail element of the protocol response contains a ResponseVersion element and zero or one ResponseCollection elements.");
// Verify requirements related with ResponseVersion
ValidateResponseVersion(storageResponse.ResponseVersion, site);
// Verify requirements related with ResponseCollection
if (storageResponse.ResponseCollection != null)
{
ValidateResponseCollection(storageResponse.ResponseCollection, requestToken, site);
}
}
示例13: ValidateUserEmailAddress
/// <summary>
/// Capture requirements related with UserEmailAddress.
/// </summary>
/// <param name="userEmailAddress">The UserEmailAddress</param>
/// <param name="site">Instance of ITestSite</param>
private static void ValidateUserEmailAddress(string userEmailAddress, ITestSite site)
{
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R909
bool isVerifiedR909 = AdapterHelper.IsValidEmailAddr(userEmailAddress);
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R909, the format of the e-mail addresses should be as specified in [RFC2822] section 3.4.1, the actual e-mail addresses value is: {0}",
userEmailAddress);
site.CaptureRequirementIfIsTrue(
isVerifiedR909,
"MS-FSSHTTP",
909,
@"[In WhoAmISubResponseDataOptionalAttributes][UserEmailAddress] The format of the email address MUST be as specified in [RFC2822] section 3.4.1.");
// Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1467
bool isVerifiedR1467 = AdapterHelper.IsValidEmailAddr(userEmailAddress);
site.Log.Add(
LogEntryKind.Debug,
"For requirement MS-FSSHTTP_R1467, the value format of the userEmailAddress attribute should be as specified in [RFC2822], the actual userEmailAddress value is: {0}",
userEmailAddress);
site.CaptureRequirementIfIsTrue(
isVerifiedR1467,
"MS-FSSHTTP",
1467,
@"[In WhoAmISubResponseDataOptionalAttributes][UserEmailAddress] Format of the e-mail addresses MUST be:
addr-spec = local-part ""@"" domain
local-part = dot-atom / quoted-string / obs-local-part
domain = dot-atom / domain-literal / obs-domain
domain-literal = [CFWS] ""["" *([FWS] dcontent) [FWS] ""]"" [CFWS]
dcontent = dtext / quoted-pair
dtext = NO-WS-CTL / ; Non white space controls
%d33-90 / ; The rest of the US-ASCII
%d94-126 ; characters not including ""["",
; ""]"", or ""\""
quoted-pair = (""\"" text) / obs-qp
text = %d1-9 / ; Characters excluding CR and LF
%d11 /
%d12 /
%d14-127 /
obs-text
obs-text = *LF *CR *(obs-char *LF *CR)
obs-char = %d0-9 / %d11 / ; %d0-127 except CR and
%d12 / %d14-127 ; LF
obs-domain = atom *(""."" atom)
atom = [CFWS] 1*atext [CFWS]
atext = ALPHA / DIGIT / ; Any character except controls,
""!"" / ""#"" / ; SP, and specials.
""$"" / ""%"" / ; Used for atoms
""&"" / ""'"" /
""*"" / ""+"" /
""-"" / ""/"" /
""="" / ""?"" /
""^"" / ""_"" /
""`"" / ""{"" /
""|"" / ""}"" /
""~""
dot-atom = [CFWS] dot-atom-text [CFWS]
dot-atom-text = 1*atext *(""."" 1*atext)
//.........这里部分代码省略.........
示例14: VerifySpecializedKnowledge
/// <summary>
/// This method is used to test Specialized Knowledge 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 VerifySpecializedKnowledge(SpecializedKnowledge instance, ITestSite site)
{
// If the instance is not null and there are no parsing errors, then the Specialized Knowledge related adapter requirements can be directly captured.
if (null == instance)
{
site.Assert.Fail("The instance of type SpecializedKnowledge 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_R362, if stream object start type is StreamObjectHeaderStart32bit.
site.CaptureRequirementIfAreEqual<Type>(
typeof(StreamObjectHeaderStart32bit),
instance.StreamObjectHeaderStart.GetType(),
"MS-FSSHTTPB",
362,
@"[In Specialized Knowledge] Specialized Knowledge Start (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies A specialized knowledge start.");
// Directly capture requirement MS-FSSHTTPB_R363, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
363,
@"[In Specialized Knowledge] GUID (16 bytes): A GUID that specifies the type of specialized knowledge.");
bool isVerifyR364 = instance.GUID == SpecializedKnowledge.CellKnowledgeGuid ||
instance.GUID == SpecializedKnowledge.ContentTagKnowledgeGuid ||
instance.GUID == SpecializedKnowledge.WaterlineKnowledgeGuid ||
instance.GUID == SpecializedKnowledge.FragmentKnowledgeGuid;
site.Log.Add(
LogEntryKind.Debug,
"Actual GUID value {0}, expect the value either 327A35F6-0761-4414-9686-51E900667A4D, 3A76E90E-8032-4D0C-B9DD-F3C65029433E, 0ABE4F35-01DF-4134-A24A-7C79F0859844 or 10091F13-C882-40FB-9886-6533F934C21D for MS-FSSHTTPB_R364.",
instance.GUID.ToString());
// Capture requirement MS-FSSHTTPB_R364, if the GUID equals the mentioned four values {327A35F6-0761-4414-9686-51E900667A4D}, {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, {0ABE4F35-01DF-4134-A24A-7C79F0859844}, {10091F13-C882-40FB-9886-6533F934C21D}.
site.CaptureRequirementIfIsTrue(
isVerifyR364,
"MS-FSSHTTPB",
364,
@"[In Specialized Knowledge] The following GUIDs detail the type of knowledge contained: [Its value must be one of] {327A35F6-0761-4414-9686-51E900667A4D}, {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, {0ABE4F35-01DF-4134-A24A-7C79F0859844}, {10091F13-C882-40FB-9886-6533F934C21D}].");
switch (instance.GUID.ToString("D").ToUpper(CultureInfo.CurrentCulture))
{
case "327A35F6-0761-4414-9686-51E900667A4D":
// Capture requirement MS-FSSHTTPB_R365, if the knowledge data type is CellKnowledge.
site.CaptureRequirementIfAreEqual<Type>(
typeof(CellKnowledge),
instance.SpecializedKnowledgeData.GetType(),
"MS-FSSHTTPB",
365,
@"[In Specialized Knowledge][If the GUID field is set to ] {327A35F6-0761-4414-9686-51E900667A4D}, [it indicates the type of the specialized knowledge is]Cell knowledge (section 2.2.1.13.2).");
break;
case "3A76E90E-8032-4D0C-B9DD-F3C65029433E":
// Capture requirement MS-FSSHTTPB_R366, if the knowledge data type is WaterlineKnowledge.
site.CaptureRequirementIfAreEqual<Type>(
typeof(WaterlineKnowledge),
instance.SpecializedKnowledgeData.GetType(),
"MS-FSSHTTPB",
366,
@"[In Specialized Knowledge][If the GUID field is set to ] {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, [it indicates the type of the specialized knowledge is]Waterline knowledge (section 2.2.1.13.4).");
break;
case "0ABE4F35-01DF-4134-A24A-7C79F0859844":
// Capture requirement MS-FSSHTTPB_R367, if the knowledge data type is FragmentKnowledge.
site.CaptureRequirementIfAreEqual<Type>(
typeof(FragmentKnowledge),
instance.SpecializedKnowledgeData.GetType(),
"MS-FSSHTTPB",
367,
@"[In Specialized Knowledge][If the GUID field is set to ] {0ABE4F35-01DF-4134-A24A-7C79F0859844}, [it indicates the type of the specialized knowledge is]Fragment knowledge (section 2.2.1.13.3).");
break;
case "10091F13-C882-40FB-9886-6533F934C21D":
// Capture requirement MS-FSSHTTPB_R368, if the knowledge data type is ContentTagKnowledge.
site.CaptureRequirementIfAreEqual<Type>(
typeof(ContentTagKnowledge),
instance.SpecializedKnowledgeData.GetType(),
"MS-FSSHTTPB",
368,
@"[In Specialized Knowledge][If the GUID field is set to ] {10091F13-C882-40FB-9886-6533F934C21D}, [it indicates the type of the specialized knowledge is]Content tag knowledge (section 2.2.1.13.5).");
break;
default:
site.Assert.Fail("Unsupported specialized knowledge value " + instance.GUID.ToString());
break;
}
//.........这里部分代码省略.........
示例15: VerifyDataElement
/// <summary>
/// This method is used to test Data Element Types 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 VerifyDataElement(DataElement instance, ITestSite site)
{
// If the instance is not null and there are no parsing errors, then the Data Element related adapter requirements can be directly captured.
if (null == instance)
{
site.Assert.Fail("The instance of type DataElement is null due to parsing error or type casting error.");
}
bool isVerifyR246 = (int)instance.DataElementType == 0x01 ||
(int)instance.DataElementType == 0x02 ||
(int)instance.DataElementType == 0x03 ||
(int)instance.DataElementType == 0x04 ||
(int)instance.DataElementType == 0x05 ||
(int)instance.DataElementType == 0x06 ||
(int)instance.DataElementType == 0x0A;
site.Assert.IsTrue(
isVerifyR246,
"For the requirement MS-FSSHTTPB_R246, the data element type value is either 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 or 0x0A");
// Directly capture requirement MS-FSSHTTPB_R246, if there are no parsing errors.
site.CaptureRequirementIfIsTrue(
isVerifyR246,
"MS-FSSHTTPB",
246,
@"[In Data Element Types] The following table lists the possible data element types:[Its value must be one of 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x0A].");
switch ((int)instance.DataElementType)
{
case 0x01:
site.Assert.AreEqual<Type>(
typeof(StorageIndexDataElementData),
instance.Data.GetType(),
"When the DataElementType value is 0x1, expect the Data type is StorageIndexDataElementData.");
// Capture requirement MS-FSSHTTPB_R247, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
247,
@"[In Data Element Types][If the related Data Element is type of ] Storage Index (section 2.2.1.12.2), [the Data Element Type field is set to]0x01.");
// Verify the storage index data element related requirements.
this.VerifyStorageIndexDataElement(instance, site);
break;
case 0x2:
site.Assert.AreEqual<Type>(
typeof(StorageManifestDataElementData),
instance.Data.GetType(),
"When the DataElementType value is 0x2, expect the Data type is StorageManifestDataElementData.");
// Capture requirement MS-FSSHTTPB_R248, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
248,
@"[In Data Element Types][If the related Data Element is type of ] Storage Manifest (section 2.2.1.12.3), [the Data Element Type field is set to]0x02.");
// Verify the storage manifest data element related requirements.
this.VerifyStorageManifestDataElement(instance, site);
break;
case 0x03:
site.Assert.AreEqual<Type>(
typeof(CellManifestDataElementData),
instance.Data.GetType(),
"When the DataElementType value is 0x3, expect the Data type is CellManifestDataElementData.");
// Directly capture requirement MS-FSSHTTPB_R249, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
249,
@"[In Data Element Types][If the related Data Element is type of ] Cell Manifest (section 2.2.1.12.4), [the Data Element Type field is set to]0x03.");
// Verify the cell manifest data element related requirements.
this.VerifyCellManifestDataElement(instance, site);
break;
case 0x4:
site.Assert.AreEqual<Type>(
typeof(RevisionManifestDataElementData),
instance.Data.GetType(),
"When the DataElementType value is 0x4, expect the Data type is RevisionManifestDataElementData.");
// Directly capture requirement MS-FSSHTTPB_R250, if there are no parsing errors.
site.CaptureRequirement(
"MS-FSSHTTPB",
250,
@"[In Data Element Types][If the related Data Element is type of ] Revision Manifest (section 2.2.1.12.5), [the Data Element Type field is set to]0x04.");
// Verify the revision manifest data element related requirements.
this.VerifyRevisionManifestDataElement(instance, site);
break;
case 0x05:
site.Assert.AreEqual<Type>(
//.........这里部分代码省略.........