Beispiel #1
0
        public async Task RemoveContainerWorksWithNonExistingContainer()
        {
            // --- Arrange
            const string CONTAINER = "NonExisting";
            var          wfs       = new WindowsFileStorage(ROOT);
            await wfs.CreateContainerAsync("Container1");

            // --- Act
            var removed = await wfs.RemoveContainerAsync(CONTAINER);

            // --- Assert
            removed.ShouldBeFalse();
            (await wfs.ContainerExistsAsync(CONTAINER)).ShouldBeFalse();
        }
Beispiel #2
0
        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();
        }