Ejemplo n.º 1
0
        public async Task PostDocuments_ShouldSucceed()
        {
            var document1 = new { test = "value" };
            var document2 = new { test = "value" };
            PostDocumentsResponse <dynamic> response = await _docClient.PostDocumentsAsync("TestCollection", new dynamic[] { document1, document2 });

            Assert.Equal(2, response.Count);
            foreach (var innerResponse in response)
            {
                Assert.False(string.IsNullOrWhiteSpace(innerResponse._id));
                Assert.False(string.IsNullOrWhiteSpace(innerResponse._key));
                Assert.False(string.IsNullOrWhiteSpace(innerResponse._rev));
                Assert.Null(innerResponse.New);
                Assert.Null(innerResponse.Old);
            }
        }
        public async Task DeleteDocuments_ShouldSucceed_WhenSilent()
        {
            var createResponse = await _docClient.PostDocumentsAsync(
                _testCollection,
                new object[] {
                new { testKey = "testValue" },
                new { testKey = "testValue" }
            });

            Assert.Equal(2, createResponse.Count);

            var deleteResponse = await _docClient.DeleteDocumentsAsync(
                _testCollection,
                createResponse.Select(x => x._key).ToList(),
                new DeleteDocumentsQuery()
            {
                Silent = true
            });

            Assert.Empty(deleteResponse);
        }