Esempio n. 1
0
        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);
        }