Skip to content

Commit cc25f20

Browse files
committed
Test for direct mango query
1 parent ebcc0ba commit cc25f20

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/CouchDB.Driver.UnitTests/Database_Tests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ public async Task FindWithConflicts()
4949
}
5050
}
5151
[Fact]
52+
public async Task Query()
53+
{
54+
using (var httpTest = new HttpTest())
55+
{
56+
var expected = new List<Rebel>() { new Rebel { Id = "aoeuidhtns" } };
57+
httpTest.RespondWithJson(new { Docs = expected });
58+
59+
var query = new { selector = new { age = 19 } };
60+
var result = await _rebels.QueryAsync(query);
61+
httpTest
62+
.ShouldHaveCalled("http://localhost/rebels/_find")
63+
.WithVerb(HttpMethod.Post)
64+
.WithRequestBody(@"{""selector"":{""age"":19}}");
65+
Assert.Equal(expected.Count, result.Count);
66+
Assert.Equal(expected[0].Id, result[0].Id);
67+
}
68+
}
69+
[Fact]
5270
public async Task Create()
5371
{
5472
using (var httpTest = new HttpTest())

0 commit comments

Comments
 (0)