Esempio 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.");
        }
Esempio 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.*");
        }
Esempio 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.*");
        }
Esempio 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.");
        }
Esempio 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.");
        }
Esempio 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>();
        }
Esempio 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.");
        }
Esempio 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();
        }