Ejemplo n.º 1
0
        private void When_including_volume_for_invalid_name_it_must_fail([NotNull] string driveName)
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            Action action = () => builder.IncludingVolume(driveName, new FakeVolumeInfoBuilder());

            // Assert
            action.Should().ThrowExactly <NotSupportedException>().WithMessage("The given path's format is not supported.");
        }
Ejemplo n.º 2
0
        private void When_including_volume_for_empty_string_name_it_must_fail()
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            Action action = () => builder.IncludingVolume(string.Empty, new FakeVolumeInfoBuilder());

            // Assert
            action.Should().ThrowExactly <ArgumentException>().WithMessage("'name' cannot be empty.*");
        }
Ejemplo n.º 3
0
        private void When_including_volume_for_whitespace_name_it_must_fail()
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            Action action = () => builder.IncludingVolume(" ", new FakeVolumeInfoBuilder());

            // Assert
            action.Should().ThrowExactly <ArgumentException>().WithMessage("'name' cannot contain only whitespace.*");
        }
Ejemplo n.º 4
0
        private void When_including_volume_for_reserved_name_it_must_fail()
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            Action action = () => builder.IncludingVolume(@"COM1", new FakeVolumeInfoBuilder());

            // Assert
            action.Should().ThrowExactly <PlatformNotSupportedException>().WithMessage("Reserved names are not supported.");
        }
Ejemplo n.º 5
0
        private void When_including_volume_for_network_host_without_share_it_must_fail()
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            Action action = () => builder.IncludingVolume(@"\\fileserver", new FakeVolumeInfoBuilder());

            // Assert
            action.Should().ThrowExactly <ArgumentException>().WithMessage(@"The UNC path should be of the form \\server\share.");
        }
Ejemplo n.º 6
0
        private void When_including_volume_for_null_builder_it_must_fail()
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            // ReSharper disable once AssignNullToNotNullAttribute
            Action action = () => builder.IncludingVolume("c:", (FakeVolumeInfoBuilder)null);

            // Assert
            action.Should().ThrowExactly <ArgumentNullException>();
        }
Ejemplo n.º 7
0
        private void When_overwriting_implicit_volume_it_must_fail()
        {
            // Arrange
            FakeFileSystemBuilder builder = new FakeFileSystemBuilder()
                                            .IncludingEmptyFile(@"C:\folder\file.txt");

            // Act
            Action action = () => builder.IncludingVolume("c:", new FakeVolumeInfoBuilder());

            // Assert
            action.Should().ThrowExactly <InvalidOperationException>().WithMessage("Volume 'c:' has already been created.");
        }
Ejemplo n.º 8
0
        private void When_including_volume_for_drive_or_network_share_it_must_succeed([NotNull] string driveName)
        {
            // Arrange
            var builder = new FakeFileSystemBuilder();

            // Act
            IFileSystem fileSystem = builder
                                     .IncludingVolume(driveName, new FakeVolumeInfoBuilder())
                                     .Build();

            // Assert
            fileSystem.Directory.Exists(driveName).Should().BeTrue();
        }