public void constructor_should_initialize_subject() { var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); subject.CollectionNamespace.Should().BeSameAs(_collectionNamespace); subject.MessageEncoderSettings.Should().BeSameAs(_messageEncoderSettings); }
public void CollectionNamespace_get_should_return_expected_result() { var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); var result = subject.CollectionNamespace; result.Should().BeSameAs(_collectionNamespace); }
public void Execute_should_throw_when_binding_is_null( [Values(false, true)] bool async) { var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); Action action = () => ExecuteOperation(subject, null, async); action.ShouldThrow <ArgumentNullException>().And.ParamName.Should().Be("binding"); }
public void BatchSize_get_and_set_should_work() { var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); int batchSize = 2; subject.BatchSize = batchSize; var result = subject.BatchSize; result.Should().Be(batchSize); }
public void Execute_should_return_expected_result_when_database_does_not_exist( [Values(false, true)] bool async) { DropDatabase(async); var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); var result = ExecuteOperation(subject, async); var list = ReadCursorToEnd(result, async); list.Count.Should().Be(0); }
public void Execute_should_return_expected_result( [Values(false, true)] bool async) { EnsureCollectionExists(async); var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); var result = ExecuteOperation(subject, async); var list = ReadCursorToEnd(result, async); list.Select(index => index["name"].AsString).Should().BeEquivalentTo("_id_"); }
public void Execute_should_return_expected_result_when_database_does_not_exist( [Values(false, true)] bool async) { RequireServer.Check().ClusterTypes(ClusterType.Standalone, ClusterType.ReplicaSet).StorageEngine("mmapv1"); DropDatabase(async); var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); var result = ExecuteOperation(subject, async); var list = ReadCursorToEnd(result, async); list.Count.Should().Be(0); }
public void Execute_should_return_expected_result( [Values(false, true)] bool async) { RequireServer.Check().ClusterTypes(ClusterType.Standalone, ClusterType.ReplicaSet).StorageEngine("mmapv1"); EnsureCollectionExists(async); var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings); var result = ExecuteOperation(subject, async); var list = ReadCursorToEnd(result, async); list.Select(index => index["name"].AsString).Should().BeEquivalentTo("_id_"); }
public void Execute_should_return_the_expected_result_when_batchSize_is_used([Values(false, true)] bool async) { RequireServer.Check().ClusterTypes(ClusterType.Standalone, ClusterType.ReplicaSet).StorageEngine("mmapv1").Authentication(authentication: false); EnsureCollectionExists(async); int batchSize = 3; var subject = new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings) { BatchSize = batchSize }; using (var result = ExecuteOperation(subject, async) as AsyncCursor <BsonDocument>) { result._batchSize().Should().Be(batchSize); } }