public void CreateDatabaseTest() { const string uriBase = "http://localhost:5984/"; IUserCredential crd = new UserCredential("Professor", "Farnsworth"); var sessionFactory = new CouchSessionFactory(uriBase, crd, AuthenticationLevel.Cookie); var response1 = sessionFactory.CreateDataBase("ciccio"); Assert.IsTrue(response1.StatusCode == HttpStatusCode.Created); var response2 = sessionFactory.DeleteDataBase("ciccio"); Assert.IsTrue(response2.StatusCode == HttpStatusCode.OK); }
public void FailedDeleteDatabaseTest() { const string uriBase = "http://localhost:5984/"; IUserCredential crd = new UserCredential("Professor", "Farnsworth"); var sessionFactory = new CouchSessionFactory(uriBase, crd, AuthenticationLevel.Cookie); var response = sessionFactory.DeleteDataBase("nodb"); var rr = response.ResponseAs<HttpErrorResponse>(); Assert.IsNotNull(rr); Assert.AreEqual(rr.Reason, "missing"); Assert.IsNotNull(response.StatusCode == HttpStatusCode.NotFound); }