File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/MongoDB.Driver.GridFS.Tests Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 22
22
using FluentAssertions ;
23
23
using MongoDB . Bson ;
24
24
using MongoDB . Driver . Core . Clusters ;
25
+ using MongoDB . Driver . Tests ;
25
26
using NSubstitute ;
26
27
using NUnit . Framework ;
27
28
@@ -171,6 +172,22 @@ public void DownloadToStreamByNameAsync_should_throw_when_filename_is_null()
171
172
action . ShouldThrow < ArgumentNullException > ( ) . And . ParamName . Should ( ) . Be ( "filename" ) ;
172
173
}
173
174
175
+ [ Test ]
176
+ public async Task DropAsync_should_drop_the_files_and_chunks_collections ( )
177
+ {
178
+ var client = DriverTestConfiguration . Client ;
179
+ var database = client . GetDatabase ( DriverTestConfiguration . DatabaseNamespace . DatabaseName ) ;
180
+ var subject = new GridFSBucket ( database ) ;
181
+ await subject . UploadFromBytesAsync ( "test" , new byte [ ] { 0 } ) ; // causes the collections to be created
182
+
183
+ await subject . DropAsync ( ) ;
184
+
185
+ var collections = await ( await database . ListCollectionsAsync ( ) ) . ToListAsync ( ) ;
186
+ var collectionNames = collections . Select ( c => c [ "name" ] . AsString ) ;
187
+ collectionNames . Should ( ) . NotContain ( "fs.files" ) ;
188
+ collectionNames . Should ( ) . NotContain ( "fs.chunks" ) ;
189
+ }
190
+
174
191
[ Test ]
175
192
public void Findsync_should_throw_when_filter_is_null ( )
176
193
{
You can’t perform that action at this time.
0 commit comments