public void TestCase_S09_TC05_GetVersions_Success_Results_VersionData() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot disable the version on the document library {0}", documentLibraryName); } // Prepare a file. string fileUrl = this.PrepareFile(); // Initialize the context this.InitializeContext(fileUrl, this.UserName01, this.Password01, this.Domain); // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(fileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", fileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(fileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation GetVersions."; if (!SutManagedAdapter.CheckInFile(fileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", fileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(fileUrl); // Check out one file by a specified user name again. if (!this.SutManagedAdapter.CheckOutFile(fileUrl, this.UserName02, this.Password02, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", fileUrl, this.UserName02, this.Password02); } this.StatusManager.RecordFileCheckOut(fileUrl, this.UserName02, this.Password02, this.Domain); string checkInComments2 = "New Comment2 for testing purpose on the operation GetVersions."; if (!SutManagedAdapter.CheckInFile(fileUrl, this.UserName02, this.Password02, this.Domain, checkInComments2)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", fileUrl, this.UserName02, this.Password02); } this.StatusManager.CancelRecordCheckOut(fileUrl); // Query changes from the protocol server CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse queryResponse = Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { queryChange }); CellSubResponseType querySubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(queryResponse, 0, 0, this.Site); this.Site.Assert.AreEqual(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(querySubResponse.ErrorCode, this.Site), "The operation QueryChanges should succeed."); FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(querySubResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site); int contentLength = new IntermediateNodeObject.RootNodeObjectBuilder().Build( fsshttpbResponse.DataElementPackage.DataElements, fsshttpbResponse.CellSubResponses[0].GetSubResponseData <QueryChangesSubResponseData>().StorageIndexExtendedGUID).GetContent().Count; // Invoke "GetVersions" sub-request with the test file URL that under a document list which is enable versioning. GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { getVersionsSubRequest }); GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null."); this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null."); // Make sure the error code value in the response equals "Success" Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"The response of the ""getVersions"" sub-request on the file {0} should succeed.", this.DefaultFileUrl); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the result contains 3 versions (1.the original, 2. User01 checked in, 3 User02 checked in), then the MS-FSSHTTP requirement: MS-FSSHTTP_R2307 is verified. Site.CaptureRequirementIfAreEqual <int>( 3, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length, "MS-FSSHTTP", 2307, @"[In GetVersionsSubResponseType][Results complex type] result: A separate result element MUST exist for each version of the file that the user can access."); // If the result contains 3 versions (1.the original, 2. User01 checked in, 3 User02 checked in), then the MS-FSSHTTP requirement: MS-FSSHTTP_R30841 is verified. Site.CaptureRequirementIfAreEqual <int>( 3, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length, "MS-FSSHTTP", 30841, @"[In GetVersionsResponse] GetVersionsResult: An XML node that contains the details about all the versions of the specified file that the user can access."); } else { Site.Assert.AreEqual <int>( 3, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length, @"[In GetVersionsSubResponseType][Results complex type] result: A separate result element MUST exist for each version of the file that the user can access."); } bool isFindVersion = false; bool isNotStartWithAt = false; foreach (VersionData item in getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result) { if (string.Compare(checkInComments2, item.comments, StringComparison.OrdinalIgnoreCase) == 0) { bool isCreatedBy = item.createdBy != null && item.createdBy.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0; this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2312, expect the CreatedBy contains the user name {0}, the actual value is {1}", this.UserName02, item.createdBy); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2312 Site.CaptureRequirementIfIsTrue( isCreatedBy, "MS-FSSHTTP", 2312, @"[In GetVersionsSubResponseType][VersionData complex type] createdBy: The creator of the version of the file."); bool isCreatedByName = item.createdByName != null && item.createdByName.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0; this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2313, expect the createdByName contains the user name {0}, the actual value is {1}", this.UserName02, item.createdByName); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2313 Site.CaptureRequirementIfIsTrue( isCreatedByName, "MS-FSSHTTP", 2313, @"[In GetVersionsSubResponseType][VersionData complex type] createdByName: The display name of the creator of the version of the file."); bool isVersion = item.version != null && item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase); this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2309, expect the version start with @, the actual value is {0}", item.version); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2309 Site.CaptureRequirementIfIsTrue( isVersion, "MS-FSSHTTP", 2309, @"[In GetVersionsSubResponseType][VersionData complex type] version: The most recent version of the file MUST be preceded with an at sign (@)."); // Using UNICODE, so the actual file size will double the length 5. Site.CaptureRequirementIfAreEqual <ulong>( (ulong)contentLength, item.size, "MS-FSSHTTP", 2314, @"[In GetVersionsSubResponseType][VersionData complex type] size: The size, in bytes, of the version of the file."); // If go through here, then the requirement MS-FSSHTTP_R2315 can be directly captured. Site.CaptureRequirement( "MS-FSSHTTP", 2315, @"[In GetVersionsSubResponseType][VersionData complex type] comments: The comment entered when the version of the file was replaced on the protocol server during check in."); } else { Site.Assert.IsTrue( isCreatedBy, @"[In GetVersionsSubResponseType][VersionData complex type] createdBy: The creator of the version of the file."); Site.Assert.IsNotNull( item.createdRaw, @"[In GetVersionsSubResponseType] Implementation does return this attribute[createdRaw]. [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.)"); bool isCreatedByName = item.createdByName != null && item.createdByName.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0; Site.Assert.IsTrue( isCreatedByName, @"[In GetVersionsSubResponseType][VersionData complex type] createdByName: The display name of the creator of the version of the file."); bool isVersion = item.version != null && item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase); Site.Assert.IsTrue( isVersion, @"[In GetVersionsSubResponseType][VersionData complex type] version: The most recent version of the file MUST be preceded with an at sign (@)."); Site.Assert.AreEqual <ulong>( (ulong)contentLength, item.size, @"[In GetVersionsSubResponseType][VersionData complex type] size: The size, in bytes, of the version of the file."); } isFindVersion = true; } else { isNotStartWithAt = !item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase); } } if (!isFindVersion) { this.Site.Assert.Fail("Cannot find the Version record for the comment {0}", checkInComments2); } Site.Log.Add( LogEntryKind.Debug, "All the other versions MUST exist without any prefix, and actually they {0} have prefix.", isNotStartWithAt ? "do not" : "do"); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2310 Site.CaptureRequirementIfIsTrue( isNotStartWithAt, "MS-FSSHTTP", 2310, @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. "); } else { Site.Assert.IsTrue( isNotStartWithAt, @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. "); } }
public void TestCase_S16_TC05_FileVersionEventDataType_Rename() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning."; if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl); string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1); string newName = Common.GenerateResourceName(this.Site, "fileName") + ".txt"; FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, null, this.Site); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(fileOperationSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(fileOperationSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); string fileUrl = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1) + newName; VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Get version list should succeed."); this.Site.Assert.AreEqual <int>( 2, versioningSubResponse.SubResponseData.Versions.Version.Length, "There should be 2 version numbers."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1117502 Site.CaptureRequirementIfIsNull( versioningSubResponse.SubResponseData.Versions.Version[1].IsCurrent, "MS-FSSHTTP", 1117502, @"[In FileVersionDataType] IsCurrent: This attribute is not present if this version is not the most recent version of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11189 Site.CaptureRequirementIfAreEqual <string>( "2", versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].Type, "MS-FSSHTTP", 11189, @"[In FileVersionEventDataType] 2 means A user renamed the file."); }
public void TestCase_S16_TC03_Versioning_RestoreVersion_VersionNotFound() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning."; if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl); GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest }); GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "3.0", this.Site); cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(versioningSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(versioningSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11247 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11247, @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]If the protocol server gets a versioning subrequest of type ""Restore version"" and the restore fails because the version number specifies a non-existent version, the protocol server returns an error code value set to ""VersionNotFound""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11256 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11256, @"[In Restore Version] If the Version attribute specifies a version that doesn't exist, the protocol server returns an error status set to ""VersionNotFound""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11083 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11083, @"[In VersioningRelatedErrorCodeTypes] The value ""VersionNotFound"" indicates that the version number specified by the protocol client doesn’t match a version of the file on the protocol server."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), @"Error VersionNotFound should be returned if restore version with not found version."); } }
public void TestCase_S16_TC04_FileVersionEventDataType_Restore() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning."; if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "1.0", this.Site); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Restore file version should succeed."); GetDocMetaInfoSubRequestType getDocMetaInfoSubRequest = SharedTestSuiteHelper.CreateGetDocMetaInfoSubRequest(SequenceNumberGenerator.GetCurrentToken()); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getDocMetaInfoSubRequest }); GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetDocMetaInfoSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site), "Get doc meta info should succeed."); versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Get version list should succeed."); this.Site.Assert.AreEqual <int>( 3, versioningSubResponse.SubResponseData.Versions.Version.Length, "There should be 3 version numbers."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11190 Site.CaptureRequirementIfAreEqual <string>( "3", versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].Type, "MS-FSSHTTP", 11190, @"[In FileVersionEventDataType] 3 means A user restored the file content to its state at a previous version."); GetDocMetaInfoPropertyType lastModifiedProperty = null; foreach (GetDocMetaInfoPropertyType property in getDocMetaInfoSubResponse.SubResponseData.DocProps.Property) { if (property.Key.ToLower().Contains("timelastmodified")) { lastModifiedProperty = property; } } Site.Assert.IsNotNull(lastModifiedProperty, "Property for last modified time should be found."); System.DateTime time = Convert.ToDateTime(lastModifiedProperty.Value); long createTime = long.Parse(versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].CreateTime); bool isR11193Verified = ((System.Math.Round((double)createTime / 10000000)) == (time - new System.DateTime(1601, 1, 1, 0, 0, 0)).TotalSeconds); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11193 Site.CaptureRequirementIfIsTrue( isR11193Verified, "MS-FSSHTTP", 11193, @"[In FileVersionEventDataType] CreateTime specifies the number of 100-nanosecond intervals that have elapsed since 00:00:00 on January 1, 1601, which MUST be Coordinated Universal Time (UTC)."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11192 Site.CaptureRequirementIfIsTrue( isR11193Verified, "MS-FSSHTTP", 11192, @"[In FileVersionEventDataType] A single tick represents 100 nanoseconds, or one ten-millionth of a second."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11194 Site.CaptureRequirementIfAreEqual <string>( versioningSubResponse.SubResponseData.UserTable.User[0].UserId, versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].UserId, "MS-FSSHTTP", 11194, @"[In FileVersionEventDataType] UserId: An integer which specifies which user performed this event."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11195 Site.CaptureRequirementIfAreEqual <string>( versioningSubResponse.SubResponseData.UserTable.User[0].UserId, versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].UserId, "MS-FSSHTTP", 11195, @"[In FileVersionEventDataType] The UserId MUST match the UserId attribute of a UserDataType (section 2.3.1.42) described in the VersioningUserTableType in the current VersioningSubResponseDataType."); }
public void TestCase_S16_TC02_Versioning_RestoreVersion_Success() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning."; if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl); GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest }); GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "1.0", this.Site); cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(versioningSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(versioningSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11248 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11248, @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]An ErrorCode value of ""Success"" indicates success in processing the versioning request."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11254 Site.CaptureRequirement( "MS-FSSHTTP", 11254, @"[In Restore Version] If the VersioningRequestType attribute is set to ""RestoreVersion"", the protocol server considers the versioning subrequest to be of type ""Restore Version"". "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11255 Site.CaptureRequirement( "MS-FSSHTTP", 11255, @"[In Restore Version] The protocol server processes this request by restoring the file to its state in the version specified by the Version attribute."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), @"Restore version should succeed."); } }