public async Task ReturnCorrectAnswer_ForEmptyDirectory() { var list = await Hosting.GetDirectoryListAsync("Empty dir"); list .Select(i => i.Name) .ShouldBeEquivalentTo(new string[0]); }
public async Task ReturnCorrectAnswer_ForNonEmptyDirectory() { var list = await Hosting.GetDirectoryListAsync("Non empty dir"); list .Select(i => i.Name) .ShouldBeEquivalentTo(new [] { "Горы.jpg", "Зима.jpg", "Medveds.jpg", "Море.jpg" }); }
public async Task List(string path, string pattern) { var re = new Regex(pattern); var items = await Hosting.GetDirectoryListAsync(path); dirListVisuzlizer.PagedShow(items .Where(i => re.IsMatch(i.Name)) .Select(i => new[] { i.Name, i.LastWriteTime.ToString(), i.IsDirectory ? "" : i.Size.ToShortString() })); }
public async Task CorrectWork_WhenNonEmptyDirectoryExist() { if (!(await Hosting.GetDirectoryListAsync(name)).Any()) { Assert.Ignore($"Put file and dir to '{name}'"); } await Hosting.RemoveDirectoryAsync(name, true); (await Hosting.IsExistAsync(name)).Should().BeFalse(); }
public async Task List(string path) { var items = await Hosting.GetDirectoryListAsync(path); dirListVisuzlizer.PagedShow(items.Select(i => new[] { i.Name, i.LastWriteTime.ToString(), i.IsDirectory ? "" : i.Size.ToShortString() })); }
public void ThrowsException_WhenHostingUnaviable() { DisableInternet(); AssertThrows <HostUnavailable>(Hosting.GetDirectoryListAsync("Empty dir")); }
public void ThrowsException_WhenPathUnexist() { AssertThrows <ItemNotFound>(Hosting.GetDirectoryListAsync("BAD PATH")); }
public void ThrowsException_WhenPathToFile() { AssertThrows <UnexpectedItemType>(Hosting.GetDirectoryListAsync("file.jpg")); }