private static void ShowCars() { TryConnectTo(CarsDb); TryLoadAllToDataTableFrom(CarsDb, "Inventory"); PrintDataTable(); CarsDb.CloseConnection(); }
public void CanCloseOpenedConnection() { var cars = new CarsDb(); cars.OpenConnection(ConnectionString); cars.CloseConnection(); Assert.IsTrue(cars.Connection.State == ConnectionState.Closed); }
public void ProcessCreditRisks() { var cars = new CarsDb(); cars.OpenConnection(ConnectionString); var customersTable = cars.GetAllFrom("Customers"); //CarsDb.ProcessCredirRisk(true, custId); cars.CloseConnection(); }
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(); }
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(); }
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(); }
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(); }
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(); }