private void ParseOptions(BsonDocument options)
        {
            foreach (var option in options.Elements)
            {
                _options = _options ?? new GridFSUploadOptions();
                switch (option.Name)
                {
                    case "aliases":
#pragma warning disable 618
                        _options.Aliases = option.Value.AsBsonArray.Select(v => v.AsString);
#pragma warning restore
                        break;

                    case "chunkSizeBytes":
                        _options.ChunkSizeBytes = option.Value.ToInt32();
                        break;

                    case "contentType":
#pragma warning disable 618
                        _options.ContentType = option.Value.AsString;
#pragma warning restore
                        break;

                    case "metadata":
                        _options.Metadata = option.Value.AsBsonDocument;
                        break;

                    default:
                        throw new ArgumentException(string.Format("Invalid option name: {0}.", option.Name));
                }
            }
        }
        public void BatchSize_set_should_have_expected_result()
        {
            var subject = new GridFSUploadOptions();

            subject.BatchSize = 123;

            subject.BatchSize.Should().Be(123);
        }
        public void BatchSize_get_should_return_expected_result()
        {
            var subject = new GridFSUploadOptions { BatchSize = 123 };

            var result = subject.BatchSize;

            result.Should().Be(123);
        }
        public void BatchSize_set_should_throw_when_value_is_invalid(
            [Values(-1, 0)]
            int value)
        {
            var subject = new GridFSUploadOptions();

            Action action = () => subject.BatchSize = value;

            action.ShouldThrow<ArgumentException>().And.ParamName.Should().Be("value");
        }
        public void Aliases_set_should_have_expected_result()
        {
            var subject = new GridFSUploadOptions();
            var value = new[] { "alias" };

#pragma warning disable 618
            subject.Aliases = value;

            subject.Aliases.Should().BeSameAs(value);
#pragma warning restore
        }
        public void Aliases_get_should_return_expected_result()
        {
#pragma warning disable 618
            var value = new[] { "alias" };
            var subject = new GridFSUploadOptions { Aliases = value };

            var result = subject.Aliases;
#pragma warning restore

            result.Should().BeSameAs(value);
        }
        public void ChunkSizeBytes_set_should_have_expected_result()
        {
            var subject = new GridFSUploadOptions();

            subject.ChunkSizeBytes = 123;

            subject.ChunkSizeBytes.Should().Be(123);
        }
        public void ChunkSizeBytes_get_should_return_expected_result()
        {
            var subject = new GridFSUploadOptions { ChunkSizeBytes = 123 };

            var result = subject.ChunkSizeBytes;

            result.Should().Be(123);
        }
        public void Metadata_set_should_have_expected_result()
        {
            var subject = new GridFSUploadOptions();
            var value = new BsonDocument("meta", 1);

            subject.Metadata = value;

            subject.Metadata.Should().BeSameAs(value);
        }
        public void Metadata_get_should_return_expected_result()
        {
            var value = new BsonDocument("meta", 1);
            var subject = new GridFSUploadOptions { Metadata = value };

            var result = subject.Metadata;

            result.Should().BeSameAs(value);
        }
        public void default_constructor_should_return_expected_result()
        {
            var result = new GridFSUploadOptions();

#pragma warning disable 618
            result.Aliases.Should().BeNull();
            result.BatchSize.Should().NotHaveValue();
            result.ChunkSizeBytes.Should().NotHaveValue();
            result.ContentType.Should().BeNull();
            result.Metadata.Should().BeNull();
#pragma warning restore
        }
        public void ContentType_set_should_throw_when_value_is_invalid()
        {
#pragma warning disable 618
            var subject = new GridFSUploadOptions();

            Action action = () => subject.ContentType = "";

            action.ShouldThrow<ArgumentException>().And.ParamName.Should().Be("value");
#pragma warning restore
        }
        public void ContentType_set_should_have_expected_result()
        {
#pragma warning disable 618
            var subject = new GridFSUploadOptions();

            subject.ContentType = "type";

            subject.ContentType.Should().Be("type");
#pragma warning restore
        }
        public void ContentType_get_should_return_expected_result()
        {
#pragma warning disable 618
            var subject = new GridFSUploadOptions { ContentType = "type" };

            var result = subject.ContentType;

            result.Should().Be("type");
#pragma warning restore
        }