Exemplo n.º 1
0
        public async Task CreateContainerFailsWithExistingName()
        {
            // --- Arrange
            const string CONTAINER = "Container1";
            var          wfs       = new WindowsFileStorage(ROOT);
            await wfs.CreateContainerAsync(CONTAINER);

            // --- Act
            await wfs.CreateContainerAsync("Container1");
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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();
        }