public void CreateCommand_should_return_expected_result() { var subject = new ReIndexOperation(_collectionNamespace, _messageEncoderSettings); var result = subject.CreateCommand(null); var expectedResult = new BsonDocument { { "reIndex", _collectionNamespace.CollectionName } }; result.Should().Be(expectedResult); }
public void CreateCommand_should_return_expected_result_when_WriteConcern_is_set( [Values(null, 1, 2)] int?w, [Values(false, true)] bool isWriteConcernSupported) { var writeConcern = w.HasValue ? new WriteConcern(w.Value) : null; var subject = new ReIndexOperation(_collectionNamespace, _messageEncoderSettings) { WriteConcern = writeConcern }; var serverVersion = Feature.CommandsThatWriteAcceptWriteConcern.SupportedOrNotSupportedVersion(isWriteConcernSupported); var result = subject.CreateCommand(serverVersion); var expectedResult = new BsonDocument { { "reIndex", _collectionNamespace.CollectionName }, { "writeConcern", () => writeConcern.ToBsonDocument(), writeConcern != null && isWriteConcernSupported } }; result.Should().Be(expectedResult); }