Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public void ThrowsException_WhenPathUnexist()
 {
     AssertThrows <ItemNotFound>(Hosting.GetItemInfoAsync("BAD PATH"));
 }
Exemplo n.º 3
0
 public void ThrowsException_WhenHostingUnaviable()
 {
     DisableInternet();
     AssertThrows <HostUnavailable>(Hosting.GetItemInfoAsync("Empty dir"));
 }
Exemplo n.º 4
0
 public async Task <long> ReturnCorrectInfoFor(string path)
 {
     return((await Hosting.GetItemInfoAsync(path)).Size.TotalBytes);
 }