Example #1
0
 public DeleteShould() : base()
 {
     using (var repo = new SQLCarRepository(options))
     {
         repo.CreateCar(carToDelete);
     }
 }
Example #2
0
        public void GetCarByIdNotFound()
        {
            using (var Repo = new SQLCarRepository(options))
            {
                var GetCarById = Repo.GetCar(99);

                GetCarById.ShouldBeNull();
            }
        }
Example #3
0
        public void AddCarToTableReturn()
        {
            using (var Repo = new SQLCarRepository(options))
            {
                var MadeCar = Repo.CreateCar(CarToCreate);

                MadeCar.Equals(ExpectedCar).ShouldBeTrue();
            }
        }
Example #4
0
        public void GetCarByIdFromTable()
        {
            using (var Repo = new SQLCarRepository(options))
            {
                Repo.CreateCar(CarToCreate);

                var GetCarById = Repo.GetCar(1);

                GetCarById.Equals(ExpectedCar).ShouldBeTrue();
            }
        }
Example #5
0
        public void GetAllCarsFromTable()
        {
            using (var Repo = new SQLCarRepository(options))
            {
                Repo.CreateCar(CarToCreate);

                var GetAllCars = Repo.GetAll();

                GetAllCars.Contains(ExpectedCar).ShouldBeTrue();
            }
        }
Example #6
0
        public void UpdateCarReturnsUpdatedCar()
        {
            using (var repo = new SQLCarRepository(options))
            {
                repo.CreateCar(CarToCreate);
            }


            using (var Repo = new SQLCarRepository(options))
            {
                var UpdatedCar = Repo.UpdateCar(CarToUpdate);

                UpdatedCar.Equals(ExpectedCar).ShouldBeTrue();
            }
        }
Example #7
0
        public void RemoveCarFromDb()
        {
            using (var repo = new SQLCarRepository(options))
            {
                repo.Cars.Count().ShouldBe(1);

                repo.DeleteCar(1);
            }

            using (var repo = new SQLCarRepository(options))
            {
                repo.Cars.Count().ShouldBe(0);

                repo.Cars.Contains(carToDelete).ShouldBeFalse();
            }
        }
Example #8
0
        public void AddCarToTable()
        {
            using (var Repo = new SQLCarRepository(options))
            {
                Repo.Cars.Count().ShouldBe(0);

                Repo.CreateCar(CarToCreate);
            }

            using (var Repo = new SQLCarRepository(options))
            {
                Repo.Cars.Count().ShouldBe(1);

                Repo.Cars.Single().Equals(ExpectedCar).ShouldBeTrue();
            }
        }
Example #9
0
        public void UpdateCarInDB()
        {
            using (var repo = new SQLCarRepository(options))
            {
                repo.CreateCar(CarToCreate);
            }

            using (var repo = new SQLCarRepository(options))
            {
                repo.UpdateCar(CarToUpdate);
            }

            using (var repo = new SQLCarRepository(options))
            {
                repo.Cars.Single().Equals(ExpectedCar).ShouldBeTrue();
            }
        }