public void constructor_should_initialize_subject() { var subject = new ListIndexesUsingCommandOperation(_collectionNamespace, _messageEncoderSettings); subject.CollectionNamespace.Should().BeSameAs(_collectionNamespace); subject.MessageEncoderSettings.Should().BeSameAs(_messageEncoderSettings); }
public void CollectionNamespace_get_should_return_expected_result() { var subject = new ListIndexesUsingCommandOperation(_collectionNamespace, _messageEncoderSettings); var result = subject.CollectionNamespace; result.Should().BeSameAs(_collectionNamespace); }
public void Execute_should_return_expected_result_when_collection_does_not_exist( [Values(false, true)] bool async) { DropCollection(async); var subject = new ListIndexesUsingCommandOperation(_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 ListIndexesUsingCommandOperation(_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.Where(minimumVersion: "3.0.0"); DropDatabase(async); var subject = new ListIndexesUsingCommandOperation(_collectionNamespace, _messageEncoderSettings); var result = ExecuteOperation(subject, async); var list = ReadCursorToEnd(result, async); list.Count.Should().Be(0); }
public void Execute_should_throw_when_binding_is_null( [Values(false, true)] bool async) { var subject = new ListIndexesUsingCommandOperation(_collectionNamespace, _messageEncoderSettings); IReadBinding binding = null; Action action = () => ExecuteOperation(subject, binding, async); action.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("binding"); }