예제 #1
0
        public async Task QueryIncludeDocs()
        {
            var test_d = new TestD(this.db);
            var resp1  = await test_d.Upload();

            Assert.IsTrue(resp1.ok, "Design doc was not uploaded", resp1);

            var test_object = new testobject()
            {
                value1 = "dave", value2 = "abcd", ID = Rand.RandString("testobject")
            };

            await this.db.Put(test_object);

            var includedocs_response = await test_d.allTestObjsInclude.Get();

            Assert.AreEqual(1, includedocs_response.Rows.Count, "1 row should be in the resultset");
            Assert.AreEqual(includedocs_response.Rows[0].Document.value1, test_object.value1, "Same value should be returned as was sent");
        }
예제 #2
0
        public async Task UploadAndQuery()
        {
            var test_d = new TestD(this.db);
            var resp1  = await test_d.Upload();

            Assert.IsTrue(resp1.ok, "Design doc was not uploaded", resp1);

            var test_object = new testobject()
            {
                value1 = "dave", value2 = "abcd", ID = Rand.RandString("testobject")
            };

            await this.db.Put(test_object);

            var view_response = await test_d.allTestObjs.Get();

            Assert.AreEqual(1, view_response.TotalRows, "1 row should have been received according to total_rows");
            Assert.IsNotNull(view_response.Rows, "Rows should have been returend from view");
            Assert.AreEqual(1, view_response.Rows.Count, "1 row should be in the resultset");

            Assert.AreEqual(test_object.ID, view_response.Rows[0].ID, "Should have received the same object from the view");
        }