static void TestOurCodeForErrors()
 {
     VDB_Database database = new VDB_Database();
     database.AddTable("users", "username", "password");
     database.GetTable("users").InsertRow("user1", "123456");
     database.GetTable("users").InsertRow("user2", "derp");
     WriteTestName("Testing if inserting too many values into a row results in VDB_OutOfBoundsException");
     try {
         database.GetTable("users").InsertRow("user4", "dulli", "wtf");
         WriteTestResult(false);
     } catch (VDB_OutOfBoundsException) {
         WriteTestResult(true);
     }
     WriteTestName("Testing if inserting too few values into a row results in VDB_OutOfBoundsException");
     try {
         database.GetTable("users").InsertRow("user5");
         WriteTestResult(false);
     } catch (VDB_OutOfBoundsException) {
         WriteTestResult(true);
     }
     WriteTestName("Testing if inserting no values into a row results in VDB_OutOfBoundsException");
     try {
         database.GetTable("users").InsertRow();
         WriteTestResult(false);
     } catch (VDB_OutOfBoundsException) {
         WriteTestResult(true);
     }
     //To be continued
 }
 public static VDB_Database Import(string filename)
 {
     VDB_DatabaseImporter importer = new VDB_DatabaseImporter();
     VDB_Database database = new VDB_Database(importer.ImportTables(filename));
     return database;
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Verano Database Tool");
            Console.WriteLine("====================");

            Console.Write("Please enter the filename of the database you want to edit: ");
            filename = Console.ReadLine();
            if (System.IO.File.Exists(filename)) {
                database = VDB_Database.Import(filename);
            }else {
                database = new VDB_Database();
            }

            bool requestQuit = false;
            while (!requestQuit) {
                Console.Write(Environment.NewLine);
                Console.Write("Type filename <action> [arguments] to issue an action or 'quit' to close the tool: ");
                string input = Console.ReadLine();
                if (!input.StartsWith("quit")) {
                    Action(input.Split((char)32));
                } else {
                    requestQuit = true;
                }
            }
        }
Example #4
0
 static void Create()
 {
     Console.Write("Creating Database...");
     VDB_Database database = new VDB_Database();
     database.Export(filename);
     WriteTestResult(true);
 }