Skip to content

Commit

Permalink
Fixed .Docs property on ViewResult
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Murphy committed Aug 26, 2016
1 parent 31663b3 commit a261719
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions LoveSeat.IntegrationTest/CouchClientTest.cs
Expand Up @@ -7,6 +7,7 @@
using LoveSeat.Interfaces;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using NUnit.Framework;
using LoveSeat;
Expand Down Expand Up @@ -144,6 +145,20 @@ public void Should_Return_Attachment_Names()
Assert.IsTrue(doc.GetAttachmentNames().Contains("martin.jpg"));
}

[Test]
public void Should_Return_Docs_On_View()
{
var db = client.GetDatabase(baseDatabase);
var jobj =
JObject.Parse(
"{\"_id\": \"_design/Patient\",\"views\": {\"all\": {\"map\": \"function (doc) {\n emit(doc._id, null);\n }\"}},\"type\": \"designdoc\"}");
db.CreateDocument(jobj.ToString());
var bunny = new Bunny {Name = "Roger"};
db.CreateDocument(new Document<Bunny>(bunny));
var result = db.View("all", new ViewOptions {IncludeDocs = true}, "Patient");
Assert.IsTrue(result.Docs.Any());
}

[Test]
public void Should_Create_Admin_User()
{
Expand Down
2 changes: 1 addition & 1 deletion LoveSeat/ViewResult.cs
Expand Up @@ -103,7 +103,7 @@ public IEnumerable<JToken> Docs
{
get
{
return (JArray)Json["doc"];
return this.Rows.Select(x => x["doc"]);
}
}

Expand Down

0 comments on commit a261719

Please sign in to comment.