Exemplo n.º 1
0
        public void TestCreateWithEmptyDBNames()
        {
            LiteCoreException e = null;;

            try {
                OpenDB("");
            } catch (LiteCoreException ex) {
                e = ex;
                ex.Error.code.Should().Be((int)C4ErrorCode.WrongFormat, "because the database cannot have an empty name");
                ex.Error.domain.Should().Be(C4ErrorDomain.LiteCoreDomain, "because this is a LiteCore error");
            }

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

            using (var db = new Database("db", options)) {
                LiteCoreException e = null;
                try {
                    Database.Delete("db", dir);
                } catch (LiteCoreException ex) {
                    e = ex;
                    ex.Error.code.Should().Be((int)C4ErrorCode.Busy, "because an in-use database cannot be deleted");
                    ex.Error.domain.Should().Be(C4ErrorDomain.LiteCoreDomain, "because this is a LiteCore error");
                }

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