public void DatabaseSetKey() { int record; record = DatabaseStoreStatic.NewRecord(); DatabaseStoreStatic.SetKey(record, "testing"); Assert.AreEqual("testing", DatabaseStoreStatic.GetKey(record)); }
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)); }
public void DatabaseGetField() { int record; record = DatabaseStoreStatic.NewRecord(); Assert.IsFalse(DatabaseStoreStatic.HasField(record, "author")); DatabaseStoreStatic.SetField(record, "author", "first author"); Assert.IsTrue(DatabaseStoreStatic.HasField(record, "author")); DatabaseStoreStatic.DeleteField(record, "author"); Assert.IsFalse(DatabaseStoreStatic.HasField(record, "author")); DatabaseStoreStatic.DeleteRecord(record); }
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); }
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); }
public void DatabaseGetRecords() { List <int> result; result = DatabaseStoreStatic.GetRecords(); Assert.AreEqual(0, result.Count); DatabaseStoreStatic.NewRecord(); result = DatabaseStoreStatic.GetRecords(); Assert.AreEqual(1, result.Count); DatabaseStoreStatic.DeleteRecord(1); result = DatabaseStoreStatic.GetRecords(); Assert.AreEqual(0, result.Count); }
public void DatabaseGetFieldNames() { int record; record = DatabaseStoreStatic.NewRecord(); Assert.IsEmpty(DatabaseStoreStatic.GetFieldNames(record)); DatabaseStoreStatic.SetField(record, "author", "first author"); DatabaseStoreStatic.SetField(record, "title", "title"); Assert.AreEqual(2, DatabaseStoreStatic.GetFieldNames(record).Count); Assert.IsTrue(DatabaseStoreStatic.GetFieldNames(record).Contains("author")); Assert.IsTrue(DatabaseStoreStatic.GetFieldNames(record).Contains("title")); Assert.IsFalse(DatabaseStoreStatic.GetFieldNames(record).Contains("journal")); DatabaseStoreStatic.DeleteRecord(record); Assert.IsEmpty(DatabaseStoreStatic.GetFieldNames(record)); }
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")); }