Beispiel #1
0
        public async Task TruncateCollectionAsync_ShouldSucceed()
        {
            // add a document
            var response = await _adb.Document.PostDocumentAsync <object>(
                _testCollection,
                new { test = 123 });

            Assert.NotNull(response._id);

            // truncate collection
            var result = await _collectionApi.TruncateCollectionAsync(_testCollection);

            // count documents in collection, should be zero
            int count = (await _adb.Cursor.PostCursorAsync <int>(
                             query: "RETURN COUNT(@@clx)",
                             bindVars: new Dictionary <string, object> {
                ["@clx"] = _testCollection
            }))
                        .Result
                        .First();

            Assert.Equal(0, count);

            Assert.Equal(HttpStatusCode.OK, result.Code);
            Assert.False(result.Error);
            Assert.NotNull(result.Id);
            Assert.NotNull(result.GloballyUniqueId);
            Assert.Equal(2, result.Type);
            Assert.Equal(3, result.Status);
            Assert.False(result.IsSystem);
            Assert.Equal(_testCollection, result.Name);
        }
Beispiel #2
0
        public CollectionApiClientTest(CollectionApiClientTestFixture fixture)
        {
            _adb            = fixture.ArangoDBClient;
            _collectionApi  = _adb.Collection;
            _testCollection = fixture.TestCollection;

            // Truncate TestCollection before each test
            _collectionApi.TruncateCollectionAsync(fixture.TestCollection)
            .GetAwaiter()
            .GetResult();
        }
 public async Task InitializeAsync()
 {
     // Truncate TestCollection before each test
     await _collectionApi.TruncateCollectionAsync(_testCollection);
 }