Skip to content

Commit

Permalink
Prepare for Cursor<T> implementing #4 dynamic run.
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Oct 22, 2015
1 parent 9c102dd commit b2514dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
22 changes: 16 additions & 6 deletions Source/RethinkDb.Driver.Tests/ConnectionTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using FluentAssertions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
Expand Down Expand Up @@ -158,17 +159,26 @@ public void insert_an_array_of_pocos()
var result = r.db(DbName).table(TableName).insert(arr).run(conn);
result.Dump();
}


[Test]
public void get_test()
{
var foo = r.db(DbName).table(TableName).get("a").run<Foo>(conn);
foo.Dump();
}

[Test]
public void getall_test()
{
var all = r.db(DbName).table(TableName).getAll("a", "b", "c").run(conn) as Cursor<object>;

all.BufferedItems.Dump();
//all.GetType().Dump();
}

[Test]
public void Test()
{
{

Poco.Converter = o =>
{
Expand All @@ -179,11 +189,11 @@ public void Test()
}

public class Foo
{
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
{
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string id { get; set; }
public int Bar { get; set; }
public int Bar { get; set; }
public int Baz { get; set; }
}

}
}
2 changes: 1 addition & 1 deletion Source/RethinkDb.Driver/Ast/ReqlAst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ public void runNoReply(Connection conn, OptArgs globalOpts)
}

}
}
}
5 changes: 2 additions & 3 deletions Source/RethinkDb.Driver/Net/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ internal virtual T RunQuery<T>(Query query)
else if( res.IsPartial || res.IsSequence )
{
ICursor cursor = Cursor<T>.create(this, query, res);
cursor.Extend(res);
return (T) cursor;
return (T)cursor;
}
else if( res.IsWaitComplete )
{
Expand Down Expand Up @@ -294,4 +293,4 @@ public virtual Connection connect()
}


}
}
2 changes: 1 addition & 1 deletion Source/RethinkDb.Driver/Net/Cursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal interface ICursor : IEnumerable
long Token { get; }
}

internal abstract class Cursor<T> : IEnumerable<T>, IEnumerator<T>, ICursor
public abstract class Cursor<T> : IEnumerable<T>, IEnumerator<T>, ICursor
{
// public immutable members
public long Token { get; }
Expand Down

0 comments on commit b2514dc

Please sign in to comment.