public void CreateAndDelete() { var Temp = new Utilities.IO.DirectoryInfo("./Test"); Temp.Create(); Assert.True(Temp.Exists); Temp.Delete(); Assert.False(Temp.Exists); }
public void DeleteExtension() { var Temp = new Utilities.IO.DirectoryInfo("./Test"); Temp.Create(); for (int x = 0; x < 10; ++x) { new Utilities.IO.FileInfo("./Test/" + x + ".txt").Write("Testing this out"); } Temp.EnumerateFiles().Delete(); Temp.Delete(); }
public void DeleteExtension() { var Temp = new Utilities.IO.DirectoryInfo("./Test"); Temp.Create(); for (int x = 0; x < 10; ++x) { new Utilities.IO.DirectoryInfo("./Test/" + x).Create(); } Temp.EnumerateDirectories().Delete(); Temp.Delete(); }
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); }
/// <summary> /// Deletes this instance of a <see cref="T:Utilities.IO.DirectoryInfoWrapper" /> , specifying whether to delete subdirectories and files. /// </summary> /// <param name="recursive"> true to delete this directory, its subdirectories, and all files; otherwise, false. </param> /// <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 read-only.-or- The directory contains one or more files or subdirectories and /// <paramref name="recursive" /> /// is false.-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(bool recursive) { _di.Delete(recursive); }