public void Can_get_all_existing_account_Types()
        {
            IAccountTypeRepository repository = new AccountTypeRepository();
            var fromDb = repository.GetAll();

            Assert.AreEqual(fromDb.Count, 7);
            Assert.IsTrue(IsInCollection(_accountTypes[0], fromDb));
            Assert.IsTrue(IsInCollection(_accountTypes[1], fromDb));
            Assert.IsTrue(IsInCollection(_accountTypes[2], fromDb));
            Assert.IsTrue(IsInCollection(_accountTypes[3], fromDb));
            Assert.IsTrue(IsInCollection(_accountTypes[4], fromDb));
            Assert.IsTrue(IsInCollection(_accountTypes[5], fromDb));
            Assert.IsTrue(IsInCollection(_accountTypes[6], fromDb));
        }
예제 #2
0
        private static void ExportAccountTypes(OleDbConnection dbConnection)
        {
            OleDbCommand createTable = new OleDbCommand("CREATE TABLE `AccountTypes` (" +
                "`Name` LongText, " +
                "`IsSource` LongText, " +
                "`IsDestination` LongText, " +
                "`IsValid` LongText " +
                ")", dbConnection);
            createTable.ExecuteNonQuery();

            AccountTypeRepository repository = new AccountTypeRepository();

            var accountTypes = repository.GetAll();

            foreach (AccountType a in accountTypes)
            {
                string insertStatement = "INSERT INTO [AccountTypes] ([Name], [IsSource], [IsDestination], [IsValid]) VALUES ('" +
                    a.Name + "', '" +
                    a.IsSource + "', '" +
                    a.IsDestination + "', '" +
                    a.IsValid + "')";

                OleDbCommand insert = new OleDbCommand(insertStatement, dbConnection);
                insert.ExecuteNonQuery();
            }
        }