Пример #1
0
        public void DatabaseSetField()
        {
            int record;

            record = DatabaseStoreStatic.NewRecord();
            DatabaseStoreStatic.SetField(record, "author", "first author");
            Assert.AreEqual("first author", DatabaseStoreStatic.GetField(record, "author"));
            DatabaseStoreStatic.SetField(record, "author", "first author and second author");
            Assert.AreEqual("first author and second author", DatabaseStoreStatic.GetField(record, "author"));
            DatabaseStoreStatic.DeleteField(record, "author");
            DatabaseStoreStatic.DeleteRecord(record);
        }
Пример #2
0
        public void DatabaseDeleteField()
        {
            int record;

            record = DatabaseStoreStatic.NewRecord();
            DatabaseStoreStatic.SetField(record, "author", "first author");
            Assert.AreEqual("first author", DatabaseStoreStatic.GetField(record, "author"));
            DatabaseStoreStatic.DeleteField(record, "author");
            Assert.AreEqual("", DatabaseStoreStatic.GetField(record, "author"));
            DatabaseStoreStatic.DeleteRecord(record);
            Assert.Throws <NoResultException> (() => DatabaseStoreStatic.GetKey(record));
        }
Пример #3
0
        public void DatabaseDeleteRecord()
        {
            int record;

            record = DatabaseStoreStatic.NewRecord("test");
            DatabaseStoreStatic.SetField(record, "author", "first author");
            DatabaseStoreStatic.SetFilename(record, "file://testuri");
            Assert.DoesNotThrow(() => DatabaseStoreStatic.GetKey(record));
            Assert.AreEqual("test", DatabaseStoreStatic.GetKey(record));
            Assert.DoesNotThrow(() => DatabaseStoreStatic.GetField(record, "author"));
            Assert.AreEqual("first author", DatabaseStoreStatic.GetField(record, "author"));
            Assert.AreEqual("file://testuri", DatabaseStoreStatic.GetFilename(record));
            DatabaseStoreStatic.DeleteRecord(record);
            Assert.Throws <NoResultException> (() => DatabaseStoreStatic.GetKey(record));
            Assert.AreEqual("", DatabaseStoreStatic.GetFilename(record));
            Assert.AreEqual("", DatabaseStoreStatic.GetField(record, "author"));
        }