public void RenameDirectory() { if (!Directory.Exists(Default.Directory)) { Directory.CreateDirectory(Default.Directory); } UVDirectory.Rename(Default.Directory, Default.SecondDirectory, (e) => { Assert.IsNull(e); Assert.IsFalse(Directory.Exists(Default.Directory)); Assert.IsTrue(Directory.Exists(Default.SecondDirectory)); Directory.Delete(Default.SecondDirectory); }); Loop.Default.Run(); }
public static Task Rename(Loop loop, string path, string newPath) { var tcs = new TaskCompletionSource <object>(); try { UVDirectory.Rename(loop, path, newPath, (e) => { if (e == null) { tcs.SetResult(null); } else { tcs.SetException(e); } }); } catch (Exception e) { tcs.SetException(e); } return(tcs.Task); }