Microsoft.Protocols.TestSuites.MS_COPYS.S02_CopyIntoItemsLocal.MSCOPYS_S02_TC05_CopyIntoItemsLocal_SourceNotPointExistFolder C# (CSharp) Method

MSCOPYS_S02_TC05_CopyIntoItemsLocal_SourceNotPointExistFolder() private method

        public void MSCOPYS_S02_TC05_CopyIntoItemsLocal_SourceNotPointExistFolder()
        {
            // Get resource from properties,a non-existent source folder and normal destination library.
            string sourceFileUrlOnDesSut = this.GetSourceFileUrl(SourceFileUrlType.SourceFileOnDesSUT);

            // Generate invalid file URL by confusing the folder path.
            string sourceFolder = this.GenerateInvalidFolderPathForFileUrl(sourceFileUrlOnDesSut);

            // Get the first destination location.
            string desFileUrl1 = this.GetDestinationFileUrl(DestinationFileUrlType.NormalDesLibraryOnDesSUT);

            string[] desUrls = new string[] { desFileUrl1 };

            // Copy files in same SUT with non-existent source folder.
            CopyIntoItemsLocalResponse copyIntoItemsLocalResponse = MSCopysAdapter.CopyIntoItemsLocal(
                                                                                    sourceFolder,
                                                                                    desUrls);

            // Collect files from specified file URLs.
            this.CollectFileByUrl(desUrls);

            this.Site.Assert.IsNotNull(copyIntoItemsLocalResponse.Results, "The element Results should be return if CopyIntoItemsLocal operation executes successfully");
            this.Site.Assert.IsTrue(1 == copyIntoItemsLocalResponse.Results.Length, "The Results element should contain one CopyResult element.");

            // Verify MS-COPYS requirement: MS-COPYS_R111
            this.Site.CaptureRequirementIfAreEqual<CopyErrorCode>(
                CopyErrorCode.Unknown,
                copyIntoItemsLocalResponse.Results[0].ErrorCode,
                111,
                @"[In CopyErrorCode] [For CopyIntoItemsLocal operation] Unknown: This value is used to indicate an error for all other error conditions for a given destination location.");
            
            // Verify MS-COPYS requirement: MS-COPYS_R271
            this.Site.CaptureRequirementIfAreEqual<CopyErrorCode>(
                CopyErrorCode.Unknown,
                copyIntoItemsLocalResponse.Results[0].ErrorCode,
                271,
                @"[In CopyIntoItemsLocal] If the source location does not point to an existing file, then if the destination location does not point to a existing folder or file, the protocol server MUST report a failure by returning the CopyResult element (section 2.2.4.2) with the ErrorCode attribute set to ""Unknown"" for this destination location.");

            // Verify MS-COPYS requirement: MS-COPYS_R289
            this.Site.CaptureRequirementIfAreEqual<CopyErrorCode>(
                CopyErrorCode.Unknown,
                copyIntoItemsLocalResponse.Results[0].ErrorCode,
                289,
                @"[In CopyIntoItemsLocal] If the file cannot be created at the given destination location,  the protocol server 
                MUST report a failure for this destination location by setting the ErrorCode attribute of the corresponding 
                CopyResult element to ""Unknown"" and provide a string value that describes the error in the ErrorMessage attribute.");
        }