public void testEnsureExistsDoesntErrorWhenCalledTwice() { db = client.Database(DBName); Assert.DoesNotThrow(async() => { await db.EnsureExistsAsync().ConfigureAwait(continueOnCapturedContext: false); await db.EnsureExistsAsync().ConfigureAwait(continueOnCapturedContext: false); }); }
public void testCreateDocumentInDbWithSlash() { var db = client.Database("my/database"); try { db.EnsureExistsAsync().Wait(); var document = new DocumentRevision() { docId = "my/document", body = new Dictionary <string, Object>() { ["hello"] = "world" } }; var savedDocument = CreateAndAssert(document); //read ReadAndAssert(document, savedDocument); // update var updated = UpdateAndAssert(document, savedDocument); // delete DeleteAndAssert(updated); } finally { db.DeleteAsync().Wait(); } }
public void Setup() { DBName = TestConstants.defaultDatabaseName + DateTime.Now.Ticks; client = new CloudantClientBuilder(TestConstants.account) { username = TestConstants.username, password = TestConstants.password }.GetResult(); // create the database try { db = client.Database(DBName); db.EnsureExistsAsync().Wait(); Assert.NotNull(db); } catch (AggregateException ae) { Assert.Fail("Create remote database failed. Cause: " + ae.Message); } catch (Exception e) { Assert.Fail("Unexpected failure: " + e.Message); } }
public void NonExistentDatabaseException() { string DBName = "database_doesnt_exist"; var db = client.Database(DBName); Assert.Throws <DataException>(async() => await db.ListIndicesAsync(), "Test failed checking that exception is thrown when a database doesn't exist."); }
public void setup() { client = new CloudantClientBuilder(TestConstants.account) { username = TestConstants.username, password = TestConstants.password }.GetResult(); string DBName = "httphelpertests" + DateTime.Now.Ticks; db = client.Database(DBName); db.EnsureExistsAsync().Wait(); }
public void testCookieInterceptor() { CookieInterceptor cookieInterceptor = new CookieInterceptor(TestConstants.username, TestConstants.password); client = new CloudantClientBuilder(TestConstants.account) { interceptors = new List <IHttpConnectionInterceptor>() { cookieInterceptor } }.GetResult(); db = client.Database(DBName); Assert.DoesNotThrow(async() => { await db.EnsureExistsAsync().ConfigureAwait(continueOnCapturedContext: false); }, "Exception thrown while creating database using cookie interceptor. "); Assert.NotNull(db); }