Ejemplo n.º 1
0
 private static void ShowCars()
 {
     TryConnectTo(CarsDb);
     TryLoadAllToDataTableFrom(CarsDb, "Inventory");
     PrintDataTable();
     CarsDb.CloseConnection();
 }
Ejemplo n.º 2
0
        public void CanCloseOpenedConnection()
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            cars.CloseConnection();
            Assert.IsTrue(cars.Connection.State == ConnectionState.Closed);
        }
Ejemplo n.º 3
0
        public void ProcessCreditRisks()
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            var customersTable = cars.GetAllFrom("Customers");

            //CarsDb.ProcessCredirRisk(true, custId);
            cars.CloseConnection();
        }
Ejemplo n.º 4
0
        public void DeleteAutoFromInventoryTable()
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            var carId = InsertTestAutoInTheInventoryTable(cars);

            cars.DeleteAuto(carId);
            Assert.IsFalse(cars.IsPresentId("Inventory", carId));
            cars.CloseConnection();
        }
Ejemplo n.º 5
0
        public void GetAllFromDbTable(
            [Values("Inventory", "Customers")] string tableDb)
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            var dataTable = cars.GetAllFrom(tableDb);

            Assert.IsNotNull(dataTable);
            Assert.AreNotEqual(0, dataTable.Rows.Count);
            cars.CloseConnection();
        }
Ejemplo n.º 6
0
        public void GetPetNameProcedure()
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            var carId   = InsertTestAutoInTheInventoryTable(cars);
            var petName = cars.GetPetNameProcedure(carId);

            Assert.AreEqual("p", petName);
            cars.DeleteAuto(carId);
            cars.CloseConnection();
        }
Ejemplo n.º 7
0
        public void PresentId(
            [Values("Inventory", "Customers")] string tableDb)
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            var dataTable = cars.GetAllFrom(tableDb);
            var firstRow  = dataTable.Rows[0];
            var firstId   = (int)firstRow[0];

            Assert.IsTrue(cars.IsPresentId(tableDb, firstId));
            cars.CloseConnection();
        }
Ejemplo n.º 8
0
        public void UpdateAutoPetName()
        {
            var cars = new CarsDb();

            cars.OpenConnection(ConnectionString);
            var          carId           = InsertTestAutoInTheInventoryTable(cars);
            const string expectedPetName = "p2";

            cars.UpdateAutoPetName(carId, expectedPetName);
            var petName = cars.GetPetNameProcedure(carId);

            Assert.AreEqual(expectedPetName, petName);
            cars.DeleteAuto(carId);
            cars.CloseConnection();
        }