/// <summary> /// Verify the VersionData complex type related requirements /// </summary> /// <param name="versionDataArray">An array of VersionData object.</param> /// <param name="isSchemaVerified">A Boolean value indicates whether the schema has been verified.</param> private void VerifyVersionDataComplexType(VersionData[] versionDataArray, bool isSchemaVerified) { #region Verify MS-VERSS_R56 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R56"); // Verify MS-VERSS requirement: MS-VERSS_R56 Site.CaptureRequirementIfIsTrue( isSchemaVerified, 56, @"[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"" /> <s:attribute name=""createdByName"" type=""s:string"" use=""optional"" /> <s:attribute name=""size"" type=""s:unsignedLong"" use=""required"" /> <s:attribute name=""comments"" type=""s:string"" use=""required"" /> </s:complexType>"); #endregion #region Verify MS-VERSS_R58 // According to MS-OFCGLOS,the current version is the latest version of a document. // Then current version is the most recent version of the file. // If the current version is preceded with an at sign (@),then R58 will be verified. string currentVersion = AdapterHelper.GetCurrentVersion(versionDataArray); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R58, the value of current version is {0}", currentVersion); bool isR58Verified = currentVersion.StartsWith("@", System.StringComparison.CurrentCulture); // Verify MS-VERSS requirement: MS-VERSS_R58 Site.CaptureRequirementIfIsTrue( isR58Verified, 58, @"[In VersionData] version: The most recent version of the file MUST be preceded with an at sign (@)."); #endregion #region Verify MS-VERSS_R59 foreach (VersionData versionData in versionDataArray) { if (versionData.version != currentVersion) { float versionNumber; bool isR59Verified = float.TryParse(versionData.version, out versionNumber); // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-VERSS_R59, the value of version is {0}", versionData.version); // Verify MS-VERSS requirement: MS-VERSS_R59 Site.CaptureRequirementIfIsTrue( isR59Verified, 59, @"[In VersionData] version: All the other versions MUST exist without any prefix. "); } } #endregion #region Verify MS-VERSS_R60101 foreach (VersionData versionData in versionDataArray) { System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^@?\d+\.\d+$"); bool isR60101Verified = regex.IsMatch(versionData.version); if (Common.IsRequirementEnabled(60101, this.Site)) { // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-VERSS_R60101, the value of attribute version in VersionData is {0}", versionData.version); // Verify MS-VERSS requirement: MS-VERSS_R60101 Site.CaptureRequirementIfIsTrue( isR60101Verified, 60101, @"[In Appendix B: Product Behavior] Implementation does contain the version of the file, including the major version and minor version numbers connected by period, for example, ""1.0"". (Windows SharePoint Services 3.0 and above follow this behavior.)"); } } #endregion #region Verify MS-VERSS_R61 foreach (VersionData versionData in versionDataArray) { System.Uri versionDataUrl = new System.Uri(versionData.url); bool isR61Verified = AdapterHelper.ValidateAbsoluteUrlFormat(versionDataUrl); // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-VERSS_R61, the value of attribute URL in VersionData is {0}", versionData.url); // Verify MS-VERSS requirement: MS-VERSS_R61 Site.CaptureRequirementIfIsTrue( isR61Verified, 61, @"[In VersionData] url: The complete URL of the version of the file."); } #endregion #region Verify MS-VERSS_R164 foreach (VersionData versionData in versionDataArray) { bool isR16401Enabled = Common.IsRequirementEnabled(16401, this.Site); bool isR16402Enabled = Common.IsRequirementEnabled(16402, this.Site); if (isR16401Enabled) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R16401"); // Verify MS-VERSS requirement: MS-VERSS_R16401 Site.CaptureRequirementIfIsNotNull( versionData.createdRaw, 16401, @"[In Appendix B: Product Behavior] Implementation does return this attribute. [In VersionData] createdRaw: The creation date and time for the version of the file in Datetime format, as specified in [ISO-8601]. (Microsoft SharePoint Foundation 2010 and above follow this behavior.)"); } if (isR16402Enabled) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R16402"); // Verify MS-VERSS requirement: MS-VERSS_R16402 Site.CaptureRequirementIfIsNull( versionData.createdRaw, 16402, @"[In Appendix B: Product Behavior] Implementation does not return this attribute. [In VersionData] createdRaw: The creation date and time for the version of the file in Datetime format, as specified in [ISO-8601]. (<1> Section 2.2.4.3: Windows SharePoint Services 3.0 does not return this attribute.)"); } } #endregion #region Verify MS-VERSS_R65 foreach (VersionData versionData in versionDataArray) { // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-VERSS_R65, the value of attribute comments in VersionData is {0}", versionData.comments); // Verify MS-VERSS requirement: MS-VERSS_R65 Site.CaptureRequirementIfIsNotNull( versionData.comments, 65, @"[In VersionData] comments: The comment entered when the version of the file was replaced on the protocol server during check in."); } #endregion }
/// <summary> /// Verify the Results complex type related requirements /// </summary> /// <param name="result">The Results object indicates the Results complex type in response.</param> /// <param name="isSchemaVerified">A Boolean value indicates whether the schema has been verified.</param> private void VerifyResultsComplexType(Results result, bool isSchemaVerified) { #region Verify MS-VERSS_R38 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R38"); // Verify MS-VERSS requirement: MS-VERSS_R38 Site.CaptureRequirementIfIsTrue( isSchemaVerified, 38, @"[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>"); #endregion #region Verify MS-VERSS_R42 // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-VERSS_R42, the value of attribute versioning.enabled in Results is {0}", result.versioning.enabled); bool isR42Verified = result.versioning.enabled == 0 || result.versioning.enabled == 1; // Verify MS-VERSS requirement: MS-VERSS_R42 Site.CaptureRequirementIfIsTrue( isR42Verified, 42, @"[In Results] versioning.enabled: The value of this attribute [versioning.enabled] MUST be ""0"" or ""1""."); #endregion #region Verify MS-VERSS_R45 // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-VERSS_R45, the value of attribute settings.url in Results is {0}", result.settings.url); System.Uri settingsUrl = new System.Uri(result.settings.url); bool isR45Verified = AdapterHelper.ValidateAbsoluteUrlFormat(settingsUrl); // Verify MS-VERSS requirement: MS-VERSS_R45 Site.CaptureRequirementIfIsTrue( isR45Verified, 45, @"[In Results] settings.url: Specifies the URL to the webpage of versioning-related settings for the document library in which the file resides."); #endregion this.VerifyVersionDataComplexType(result.result, isSchemaVerified); }