Esempio n. 1
0
        public void Move()
        {
            IDirectory Temp  = new Utilities.IO.DirectoryInfo("./Test");
            IDirectory Temp2 = new Utilities.IO.DirectoryInfo("./Test2");

            Temp.Create();
            Temp2.Create();
            Temp2 = Temp2.MoveTo(Temp);
            Assert.True(Temp.Exists);
            Assert.True(Temp2.Exists);
            Assert.Equal(Temp, Temp2.Parent);
            Temp.Delete();
            Assert.False(Temp.Exists);
        }
 public void Move()
 {
     IDirectory Temp = new Utilities.IO.DirectoryInfo("./Test");
     IDirectory Temp2 = new Utilities.IO.DirectoryInfo("./Test2");
     Temp.Create();
     Temp2.Create();
     Temp2 = Temp2.MoveTo(Temp);
     Assert.True(Temp.Exists);
     Assert.True(Temp2.Exists);
     Assert.Equal(Temp, Temp2.Parent);
     Temp.Delete();
     Assert.False(Temp.Exists);
 }
Esempio n. 3
0
        ///// <summary>
        /////   Deletes this <see cref="T:Utilities.IO.DirectoryInfoWrapper" /> if it is empty.
        ///// </summary>
        ///// <exception cref="T:System.UnauthorizedAccessException">The directory contains a read-only file.</exception>
        ///// <exception cref="T:System.IO.DirectoryNotFoundException">The directory described by this
        /////   <see cref="T:Utilities.IO.DirectoryInfoWrapper" />
        /////   object does not exist or could not be found.</exception>
        ///// <exception cref="T:System.IO.IOException">The directory is not empty. -or-The directory is the application's current working directory.</exception>
        ///// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
        ///// <filterpriority>1</filterpriority>
        ///// <PermissionSet>
        /////   <IPermission
        /////     class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        /////     version="1" Unrestricted="true" />
        ///// </PermissionSet>
        //public void Delete()
        //{
        //    _di.Delete();
        //}

        /// <summary>
        ///   Moves a <see cref="T:Utilities.IO.DirectoryInfoWrapper" /> instance and its contents to a new path.
        /// </summary>
        /// <param name="destDirName"> The name and path to which to move this directory. The destination cannot be another disk volume or a directory with the identical name. It can be an existing directory to which you want to add this directory as a subdirectory. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="destDirName" />
        ///   is null.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="destDirName" />
        ///   is an empty string (''").</exception>
        /// <exception cref="T:System.IO.IOException">An attempt was made to move a directory to a different volume. -or-
        ///   <paramref name="destDirName" />
        ///   already exists.-or-You are not authorized to access this path.-or- The directory being moved and the destination directory have the same name.</exception>
        /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
        /// <exception cref="T:System.IO.DirectoryNotFoundException">The destination directory cannot be found.</exception>
        /// <filterpriority>1</filterpriority>
        /// <PermissionSet>
        ///   <IPermission
        ///     class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        ///     version="1" Unrestricted="true" />
        /// </PermissionSet>
        public void MoveTo(string destDirName)
        {
            _di.MoveTo(destDirName);
        }