Exemple #1
0
        public void List_Methods_Should_ProperlyPerform_CRUD_Fuctions()
        {
            Vehicle           vehicle      = new Vehicle();
            Vehicle           vehicleTwo   = new Vehicle();
            Vehicle           vehicleThree = new Vehicle();
            Vehicle           vehicleFour  = new Vehicle();
            Vehicle           vehicleFive  = new Vehicle();
            VehicleRepository _repo        = new VehicleRepository();

            _repo.AddToGasList(vehicle);
            _repo.AddToHybridList(vehicleTwo);
            _repo.AddToElectricList(vehicleThree);
            _repo.AddToGasList(vehicleFour);
            _repo.AddToHybridList(vehicleFive);

            int actual   = _repo.GetGasList().Count;
            int expected = 2;

            int actualOne   = _repo.GetHybridList().Count;
            int expectedOne = 2;

            int actualTwo   = _repo.GetElectricList().Count;
            int expectedTwo = 1;

            Assert.AreEqual(actual, expected);
            Assert.AreEqual(actualOne, expectedOne);
            Assert.AreEqual(actualTwo, expectedTwo);


            _repo.RemoveFromGasList(vehicle);
            _repo.RemoveFromHybridList(vehicleTwo);
            _repo.RemoveFromElectricList(vehicleThree);

            int actualThree   = _repo.GetGasList().Count;
            int expectedThree = 1;

            int actualFour   = _repo.GetHybridList().Count;
            int expectedFour = 1;

            int actualFive   = _repo.GetElectricList().Count;
            int expectedFive = 0;

            Assert.AreEqual(actualThree, expectedThree);
            Assert.AreEqual(actualFour, expectedFour);
            Assert.AreEqual(actualFive, expectedFive);
        }