private BsonDocument CreateInitialIsMasterCommand(IReadOnlyList <IAuthenticator> authenticators) { var command = IsMasterHelper.CreateCommand(); IsMasterHelper.AddClientDocumentToCommand(command, _clientDocument); IsMasterHelper.AddCompressorsToCommand(command, _compressors); return(IsMasterHelper.CustomizeCommand(command, authenticators)); }
public void AddCompressorsToCommand_with_compressors_should_return_expected_result( [Values( new CompressorType[] { }, new [] { CompressorType.Zlib }, new [] { CompressorType.Snappy }, new [] { CompressorType.Zlib, CompressorType.Snappy })] CompressorType[] compressorsParameters) { var command = IsMasterHelper.CreateCommand(); var compressors = compressorsParameters .Select(c => new CompressorConfiguration(c)) .ToArray(); var result = IsMasterHelper.AddCompressorsToCommand(command, compressors); var expectedCompressions = string.Join(",", compressorsParameters.Select(c => $"'{c.ToString().ToLowerInvariant()}'")); result.Should().Be(BsonDocument.Parse($"{{ isMaster : 1, compression: [{expectedCompressions}] }}")); }