public void BookBalanceSQLite() { var profile = new Profile.Profile(); var database = new Fake.Database(profile); database.Connect(); var bookName = "Sales"; float bookAmount = 100.00F; database.Add(record1); database.Add(record2); System.Collections.Generic.List <Balance> entries = Function.SQLiteBookBalance(database, bookName, bookAmount); CheckTransaction(database); Assert.Greater(entries.Count, 1); Assert.IsNotNull(entries[0].Entry); Assert.Greater(entries[0].Entry, 0); Assert.AreEqual(record1[2], entries[0].Account); Assert.AreEqual(record2[2], entries[1].Account); Assert.AreEqual(1, database.Connection.OpenCount); Assert.Less(database.Connection.CloseCount, 2); }
public void NoResultFromDatabase() { var profile = new Profile.Profile(); var database = new Fake.Database(profile); database.Connect(); Assert.AreEqual("0.0.0-Nil", database.SchemaVersion().ToString()); }
public void Setup() { log = new Core.Fake.Log(); profile = new Profile.Profile() { Log = log }; database = new Fake.Database(profile); database.Connect(); database.Connection.Open(); }
public void NormalFullResult() { var profile = new Profile.Profile(); var database = new Fake.Database(profile); database.Connect(); database.Add(new string[3] { "Business", "1.2.3", "4" }); Assert.AreEqual("Business1.2.3-4", database.SchemaVersion().ToString()); }
public void GetSingle() { var profile = new Profile.Profile(); var database = new Fake.Database(profile); database.Connect(); database.Add(new string[2] { "Stephen Arthur Jazdzewski", "Steve" }); var individual = new Individual(database, 3); Assert.AreEqual(3, individual.Id); Assert.AreEqual(true, individual.Person); Assert.AreEqual("Steve", individual.GoesBy); Assert.AreEqual("Stephen Arthur Jazdzewski", individual.FullName); }
public void CantFindTable() { var log = new Core.Fake.Log(); var profile = new Profile.Profile() { Log = log }; // Driver specific Exception Database = new Fake.Database(profile) { CommandException = new System.Exception("can't find table \"VERSIONS\"") }; Database.Connect(); Database.Connection.Open(); Assert.Throws(typeof(System.Exception), new TestDelegate(ExecuteReaderException)); Assert.That(log.Output, Contains.Substring(Log.Level.Fatal.ToString())); Assert.That(log.Output, Contains.Substring("VERSIONS")); }
public void Book() { var profile = new Profile.Profile(); var database = new Fake.Database(profile); database.Connect(); var bookName = "Sales"; float bookAmount = 111.11F; int? entryId = 1; database.SetValue(entryId); var entry = database.Book(bookName, bookAmount); CheckTransaction(database); Assert.IsNotNull(entry); Assert.Greater(entry, 0); Assert.AreEqual(entryId, entry); }
public void ReaderGet() { var log = new Core.Fake.Log(); var profile = new Profile.Profile() { Log = log }; // Driver specific Exception Database = new Fake.Database(profile) { ReaderGetException = new System.Exception("Before start of result set") }; Database.Connect(); Database.Connection.Open(); Database.Command.CommandText = ""; Reader = (Fake.Reader)Database.Command.ExecuteReader(); Reader.Read(); Assert.Throws(typeof(System.Exception), new TestDelegate(ReadGetException)); Assert.That(log.Output, Contains.Substring(Log.Level.Error.ToString())); Assert.That(log.Output, Contains.Substring("Before start")); }
public void DataReadError() { var log = new Core.Fake.Log(); var profile = new Profile.Profile() { Log = log }; var database = new Fake.Database(profile) { // Driver specific Exception ReaderGetException = new System.Exception("Before start of result set") }; database.Connect(); database.Add(new string[3] { "Business", "1.2.3", "4" }); Assert.AreEqual("0.0.0-Nil", database.SchemaVersion().ToString()); Assert.That(log.Output, Contains.Substring(Log.Level.Error.ToString())); Assert.That(log.Output, Contains.Substring("Before start")); Assert.That(log.Output, Contains.Substring("Version")); }
void HostConnectOpenException() { Database.Connect(); Database.Connection.Open(); }