public async Task Info(string path) { var o = Console.ForegroundColor; var r = ConsoleColor.Red; var g = ConsoleColor.Green; var b = ConsoleColor.Cyan; var info = await Hosting.GetItemInfoAsync(path); ColoredConsole.WriteLine(b, info.IsDirectory ? "DIRECTORY" : "FILE"); ColoredConsole.WriteLine("Name:\t", b, info.Name); ColoredConsole.WriteLine("Size:\t", b, info.Size); ColoredConsole.WriteLine(" bytes:", b, info.Size.TotalBytes, " B"); ColoredConsole.WriteLine("LW time:", b, info.LastWriteTime); ColoredConsole.WriteLine("On hostings: "); foreach (var hosting in info.Hostings) { ColoredConsole.WriteLine("\t", b, hosting.Name); } }
public void ThrowsException_WhenPathUnexist() { AssertThrows <ItemNotFound>(Hosting.GetItemInfoAsync("BAD PATH")); }
public void ThrowsException_WhenHostingUnaviable() { DisableInternet(); AssertThrows <HostUnavailable>(Hosting.GetItemInfoAsync("Empty dir")); }
public async Task <long> ReturnCorrectInfoFor(string path) { return((await Hosting.GetItemInfoAsync(path)).Size.TotalBytes); }