Пример #1
0
        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);
        }
Пример #2
0
        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());
        }
Пример #3
0
        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);
        }
Пример #4
0
        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"));
        }