Esempio n. 1
0
        public void ExecuteCreateCommand()
        {
            int initial = this.table.GetRows().Count;
            AjBaseConnection connection = new AjBaseConnection("Database=Sales");
            AjBaseCommand    command    = new AjBaseCommand("create table Customers(Name, Address)", connection);

            connection.Open();
            // TODO test return
            command.ExecuteNonQuery();
            connection.Close();

            Table table = this.database.GetTable("Customers");

            Assert.IsNotNull(table);
        }
Esempio n. 2
0
        public void ExecuteInsertCommand()
        {
            int initial = this.table.GetRows().Count;
            AjBaseConnection connection = new AjBaseConnection("Database=Sales");
            AjBaseCommand    command    = new AjBaseCommand("insert into Employees(FirstName, LastName) values('New First Name', 'New Last Name')", connection);

            connection.Open();
            int n = command.ExecuteNonQuery();

            connection.Close();

            Assert.AreEqual(1, n);

            Assert.AreEqual(initial + 1, this.table.GetRows().Count());
            Row row = this.table.GetRows().Last();

            Assert.AreEqual("New First Name", row["FirstName"]);
            Assert.AreEqual("New Last Name", row["LastName"]);
        }