Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'generics' of /home/samus/Documents/Projects/mongodb-csh…
…arp into generics
  • Loading branch information
samus committed Mar 9, 2010
2 parents 41aae7e + 62ae01c commit ad2f5da
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 199 deletions.
29 changes: 29 additions & 0 deletions MongoDB.Net-Tests/TestCursor.cs
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;

using NUnit.Framework;

using MongoDB.Driver;
Expand Down Expand Up @@ -138,5 +140,32 @@ public void TestCanReadAndKillCursor()
Assert.IsTrue(exp.Contains("n"));
Assert.IsTrue(exp.Contains("nscanned"));
}

[Test]
public void TestSearchWithNonDocument(){
IMongoCollection reads = DB["reads"];
Dictionary<string, object> fake = new Dictionary<string, object>(){{"j", 5}};
using(ICursor cur = reads.FindAll().Spec(fake)){
try{
foreach(Document d in cur.Documents){
d["returned"] = 1; //just do nothing with it.
}
}catch(Exception e){
Assert.Fail("Cursor couldn't execute. " + e.Message);
}
}
}

}

// internal class FakeDoc : IEnumerable<KeyValuePair<string, object>>{
//
// System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator (){
// return this.GetEnumerator();
// }
//
// public IEnumerator<KeyValuePair<string, object>> GetEnumerator (){
//
// }
// }
}
8 changes: 2 additions & 6 deletions MongoDB.Net-Tests/TestDocument.cs
@@ -1,10 +1,6 @@
/*
* User: scorder
* Date: 7/8/2009
*/

using System;
using System.Collections;
using System.Collections.Generic;

using NUnit.Framework;

Expand Down Expand Up @@ -152,7 +148,7 @@ public void TestValuesAdded()
Document d2 = new Document().Append("k1", new Document().Append("k2", new Document().Append("k3", "bar")));
AreNotEqual(d1, d2);
}

private void AreEqual(Document d1, Document d2) {
if (!d1.Equals(d2)) {
Assert.Fail(string.Format("Documents don't match\r\nExpected: {0}\r\nActual: {1}", d1, d2));
Expand Down

0 comments on commit ad2f5da

Please sign in to comment.