@@ -76,24 +76,25 @@ public void Ensure_DropsExtraAndCreatesMissingIndexes()
7676 { "name" , "field_1" } ,
7777 { "ns" , "test.collections" }
7878 } ;
79+ const string remainingFieldName = "remaining_field" ;
7980 var remainingDbIndex = new Dictionary < string , object >
8081 {
8182 { "v" , 2 } ,
82- { "key" , new Dictionary < string , object > { { "another_field" , 1 } } } ,
83- { "name" , "another_field_1 "} ,
83+ { "key" , new Dictionary < string , object > { { remainingFieldName , 1 } } } ,
84+ { "name" , $ " { remainingFieldName } _1 "} ,
8485 { "ns" , "test.collections" }
8586 } ;
86- database . ListCollectionNames ( ) . Returns ( new [ ] { "collectionName" } ) ;
87- database . ListIndexes ( "collectionName" ) . Returns ( new [ ] { extraIndex , remainingDbIndex } ) ;
88-
87+ const string collectionName = "collectionName" ;
88+ database . ListCollectionNames ( ) . Returns ( new [ ] { collectionName } ) ;
89+ database . ListIndexes ( collectionName ) . Returns ( new [ ] { extraIndex , remainingDbIndex } ) ;
8990
9091 var expectedCreatedIndexes = new [ ] { new Index ( keys : new Key ( "yet_another_field" , IndexType . Descending ) ) } ;
9192 var ensurer = new IndexEnsurer ( database ) ;
92- var remainingIndex = new Index ( keys : new Key ( "another_field" , IndexType . Ascending ) ) ;
93- ensurer . Ensure ( new CollectionIndexes ( "testCollection" ,
93+ var remainingIndex = new Index ( keys : new Key ( remainingFieldName , IndexType . Ascending ) ) ;
94+ ensurer . Ensure ( new CollectionIndexes ( collectionName ,
9495 expectedCreatedIndexes . Append ( remainingIndex ) . ToArray ( ) ) ) ;
95- database . Received ( ) . DropOneIndex ( " collectionName" , "field_1" ) ;
96- database . Received ( ) . CreateManyIndexes ( "testCollection" ,
96+ database . Received ( ) . DropOneIndex ( collectionName , "field_1" ) ;
97+ database . Received ( ) . CreateManyIndexes ( collectionName ,
9798 Arg . Is < Index [ ] > ( actualIndexes =>
9899 actualIndexes
99100 . SequenceEqual ( expectedCreatedIndexes ) ) ) ;
0 commit comments