public async Task CreateContainerFailsWithExistingName() { // --- Arrange const string CONTAINER = "Container1"; var wfs = new WindowsFileStorage(ROOT); await wfs.CreateContainerAsync(CONTAINER); // --- Act await wfs.CreateContainerAsync("Container1"); }
public async Task GetContainersWorksWithExistingContainers() { // --- Arrange var wfs = new WindowsFileStorage(ROOT); await wfs.CreateContainerAsync("Container1"); await wfs.CreateContainerAsync("Container2"); await wfs.CreateContainerAsync("Container3"); // --- Act var containers = await wfs.GetContainersAsync(); // --- Assert containers.Count.ShouldBe(3); }
public async Task RemoveContainerWorksWithEmptyContainer() { // --- Arrange const string CONTAINER = "EmptyContainer"; var wfs = new WindowsFileStorage(ROOT); await wfs.CreateContainerAsync("Container1"); await wfs.CreateContainerAsync(CONTAINER); // --- Act var removed = await wfs.RemoveContainerAsync(CONTAINER); // --- Assert removed.ShouldBeTrue(); (await wfs.ContainerExistsAsync(CONTAINER)).ShouldBeFalse(); }
public async Task RemoveContainerFailsWithNonEmptyContainer() { // --- Arrange const string CONTAINER = "NonEmptyContainer"; var wfs = new WindowsFileStorage(ROOT); await wfs.CreateContainerAsync("Container1"); await wfs.CreateContainerAsync(CONTAINER); var filePath = Path.Combine(ROOT, Path.Combine(CONTAINER), "file.txt"); File.WriteAllText(filePath, "TextContents"); // --- Act var removed = await wfs.RemoveContainerAsync(CONTAINER); // --- Assert removed.ShouldBeTrue(); (await wfs.ContainerExistsAsync(CONTAINER)).ShouldBeFalse(); }
public async Task EnsureContainerWorksWithExistingContainer() { // --- Arrange const string CONTAINER = "Existing"; var wfs = new WindowsFileStorage(ROOT); await wfs.CreateContainerAsync(CONTAINER); // --- Act await wfs.EnsureContainerAsync(CONTAINER); // --- Assert (await wfs.ContainerExistsAsync(CONTAINER)).ShouldBeTrue(); }
public async Task CreateContainerWorksWithNewName() { // --- Arrange const string CONTAINER = "Container1"; var wfs = new WindowsFileStorage(ROOT); var before = await wfs.ContainerExistsAsync(CONTAINER); // --- Act await wfs.CreateContainerAsync("Container1"); // --- Assert before.ShouldBeFalse(); (await wfs.ContainerExistsAsync(CONTAINER)).ShouldBeTrue(); }