Permalink
Browse files

Merge branch 'generics' of /home/samus/Documents/Projects/mongodb-csh…

…arp into generics
  • Loading branch information...
2 parents 41aae7e + 62ae01c commit ad2f5da794805f12e86b9d7a2d57973b95f22a03 @samus committed Mar 9, 2010
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+
using NUnit.Framework;
using MongoDB.Driver;
@@ -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 (){
+//
+// }
+// }
}
@@ -1,10 +1,6 @@
-/*
- * User: scorder
- * Date: 7/8/2009
- */
-
using System;
using System.Collections;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -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));
Oops, something went wrong.

0 comments on commit ad2f5da

Please sign in to comment.