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

            record = DatabaseStoreStatic.NewRecord();
            DatabaseStoreStatic.SetKey(record, "testing");
            Assert.AreEqual("testing", DatabaseStoreStatic.GetKey(record));
        }
Пример #2
0
        public void SetKey(string key)
        {
            if (DatabaseStoreStatic.GetKey(RecordId) != key)
            {
                Enter(this);
                WriteLine(5, "Key set: {0}", key);
                DatabaseStoreStatic.SetKey(RecordId, key);
                Exit(this);

                OnRecordModified(new EventArgs());
            }
        }
Пример #3
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));
        }
Пример #4
0
        public void DatabaseNewRecord()
        {
            int result;

            result = DatabaseStoreStatic.NewRecord();
            Assert.AreEqual(1, result);
            result = DatabaseStoreStatic.NewRecord("test");
            Assert.AreEqual(2, result);
            Assert.AreEqual("test", DatabaseStoreStatic.GetKey(result));
            DatabaseStoreStatic.DeleteRecord(1);
            DatabaseStoreStatic.DeleteRecord(2);
        }
Пример #5
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"));
        }
Пример #6
0
 public string GetKey()
 {
     return(DatabaseStoreStatic.GetKey(RecordId));
 }