public void EchoDatabaseTest() { const string uriBase = "http://localhost:5984/"; IUserCredential crd = new UserCredential("Professor", "Farnsworth"); var sessionFactory = new CouchSessionFactory(uriBase, crd, AuthenticationLevel.Cookie); var response = sessionFactory.EchoCouch(); Assert.IsTrue(response.StatusCode == HttpStatusCode.OK); }
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 FailedCreateDatabaseTest() { const string uriBase = "http://localhost:5984/"; IUserCredential crd = new UserCredential("Professor", "Farnsworth"); var sessionFactory = new CouchSessionFactory(uriBase, crd, AuthenticationLevel.Cookie); var response = sessionFactory.CreateDataBase("_ciccio"); var rr = response.ResponseAs<HttpErrorResponse>(); Assert.IsNotNull(rr); Assert.IsTrue(rr.Reason.StartsWith("Name:")); Assert.IsTrue(response.StatusCode == HttpStatusCode.BadRequest); }
public void ExistsDatabaseTest() { const string uriBase = "http://localhost:5984/"; IUserCredential crd = new UserCredential("Professor", "Farnsworth"); var sessionFactory = new CouchSessionFactory(uriBase, crd, AuthenticationLevel.Cookie); var response1 = sessionFactory.ExistsDataBase("db"); var rr = response1.ResponseAs<HttpErrorResponse>(); Assert.IsNotNull(rr); Assert.IsTrue(rr.Reason.StartsWith("no_db_file")); Assert.IsTrue(response1.StatusCode == HttpStatusCode.NotFound); var response2 = sessionFactory.ExistsDataBase("_users"); 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); }
public void FailedEchoDatabaseTest() { const string uriBase = "http://localhost:5900/"; IUserCredential crd = new UserCredential("Professor", "Farnsworth"); new CouchSessionFactory(uriBase, crd, AuthenticationLevel.Cookie); }