Exemple #1
0
        public void TestCreateWithEmptyDBNames()
        {
            CouchbaseLiteException e = null;;

            try {
                OpenDB("");
            } catch (CouchbaseLiteException ex) {
                e = ex;
                ex.Error.Should().Be(CouchbaseLiteError.WrongFormat, "because the database cannot have an empty name");
                ex.Domain.Should().Be(CouchbaseLiteErrorType.CouchbaseLite, "because this is a LiteCore error");
            }

            e.Should().NotBeNull("because an exception is expected");
        }
Exemple #2
0
        public void TestDeleteOpeningDBByStaticMethod()
        {
            var dir     = Directory;
            var options = new DatabaseConfiguration
            {
                Directory = dir
            };

            using (var db = new Database("db", options)) {
                CouchbaseLiteException e = null;
                try {
                    Database.Delete("db", dir);
                } catch (CouchbaseLiteException ex) {
                    e = ex;
                    ex.Error.Should().Be(CouchbaseLiteError.Busy, "because an in-use database cannot be deleted");
                    ex.Domain.Should().Be(CouchbaseLiteErrorType.CouchbaseLite, "because this is a LiteCore error");
                }

                e.Should().NotBeNull("because an exception is expected");
            }
        }