Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5b1331

Browse files
committed
Fix some compiler warnings.
1 parent 9822564 commit f5b1331

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

MongoDB.Driver.Benchmark/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static void SetupInsert(Database db, string col, bool index){
122122
Document idx = new Document().Append("x", IndexOrder.Ascending);
123123
db[col].MetaData.CreateIndex(idx,false);
124124
}
125-
}catch(MongoCommandException mce){
125+
}catch(MongoCommandException){
126126
//swallow for now.
127127
}
128128
}

MongoDB.Net-Tests/TestCollectionSafeMode.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public void TestBadInsert(){
2121
IMongoCollection col = InitCollection("safeinsert");
2222
bool thrown = false;
2323
try{
24-
col.Insert(new Document(){{"x",1},{"y",2}},true);
25-
}catch(MongoDuplicateKeyException mdk){
24+
col.Insert(new Document {{"x",1},{"y",2}},true);
25+
}catch(MongoDuplicateKeyException){
2626
thrown = true;
2727
}catch(Exception e){
2828
Assert.Fail(String.Format("Wrong exception thrown: {0}", e.GetType().Name));
@@ -35,10 +35,10 @@ public void TestBadUpdate(){
3535
IMongoCollection col = InitCollection("safeupdate");
3636
bool thrown = false;
3737
try{
38-
col.Update(new Document(){{"x", 1}}, new Document(){{"x",2}},true);
38+
col.Update(new Document {{"x", 1}}, new Document{{"x",2}},true);
3939
}catch(MongoDuplicateKeyUpdateException){
4040
thrown = true;
41-
}catch(MongoDuplicateKeyException mdk){
41+
}catch(MongoDuplicateKeyException){
4242
Assert.Fail("MongoDuplicateKeyException thown instead of MongoDuplicateKeyUpdateException");
4343
}catch(Exception e){
4444

@@ -56,10 +56,10 @@ public void TestMultiUpdate(){
5656

5757
bool thrown = false;
5858
try{
59-
col.UpdateAll(new Document(){{"x",1}}, new Document(){{"y",2}},true);
59+
col.UpdateAll(new Document{{"x",1}}, new Document{{"y",2}},true);
6060
}catch(MongoDuplicateKeyUpdateException){
6161
thrown = true;
62-
}catch(MongoDuplicateKeyException mdk){
62+
}catch(MongoDuplicateKeyException){
6363
Assert.Fail("MongoDuplicateKeyException thown instead of MongoDuplicateKeyUpdateException");
6464
}catch(Exception e){
6565

@@ -70,9 +70,9 @@ public void TestMultiUpdate(){
7070

7171
protected IMongoCollection InitCollection(string name){
7272
IMongoCollection col = DB[name];
73-
col.MetaData.CreateIndex(new Document(){{"x", IndexOrder.Ascending}}, true);
73+
col.MetaData.CreateIndex(new Document{{"x", IndexOrder.Ascending}}, true);
7474
for(int x = 0; x < 5; x++){
75-
col.Insert(new Document(){{"x", x}, {"y", 1}});
75+
col.Insert(new Document{{"x", x}, {"y", 1}});
7676
}
7777
return col;
7878
}

MongoDB.Net-Tests/TestConcurrency.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void DoInserts(){
158158
Document doc = new Document(){{"x",x},{"identifier", this.Identifier}};
159159
this.Collection.Insert(doc);
160160
this.Count++;
161-
}catch(Exception e){
161+
}catch(Exception){
162162
break;
163163
}
164164
}
@@ -181,7 +181,7 @@ public void DoReads(){
181181
}
182182
}
183183
this.Count++;
184-
}catch(Exception e){
184+
}catch(Exception){
185185
break;
186186
}
187187
}

MongoDB.Net-Tests/TestMapReduceBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public void TestExecuteUsing(){
8282
Assert.IsNotNull(mr.Result);
8383
Assert.IsTrue(mr.Result.Ok);
8484
tempcollname = tests.Name + "." + mr.Result.CollectionName;
85-
bool found = false;
8685
Assert.IsTrue(tests.GetCollectionNames().Contains(tempcollname));
8786
}
8887
Assert.IsFalse(tests.GetCollectionNames().Contains(tempcollname));

MongoDB.Net-Tests/TestMongoExceptions.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-

2-
3-
using System;
4-
using NUnit.Framework;
1+
using NUnit.Framework;
52

63
namespace MongoDB.Driver
74
{
@@ -12,7 +9,7 @@ public class TestMongoCommException
129
public void TestThrow(){
1310
try{
1411

15-
}catch(MongoCommException mce){
12+
}catch(MongoCommException){
1613
//Assert.AreEqual("localhost", mce.ConnectionString);
1714
}
1815
}

MongoDB.Net-Tests/TestOid.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void TestCtor(){
4747
bool thrown = false;
4848
try{
4949
new Oid("4a7067c30a57000000008ecb");
50-
}catch(ArgumentException ae){
50+
}catch(ArgumentException){
5151
thrown = true;
5252
}
5353
Assert.IsFalse(thrown,"ID should be fine.");

0 commit comments

Comments
 (0)