Пример #1
0
        private bool CreateVehicle()
        {
            VehicleDTO expectedVehicle = new VehicleDTO();

            expectedVehicle.Brand  = "Chevrolet";
            expectedVehicle.Model  = "Onyx";
            expectedVehicle.Year   = 2016;
            expectedVehicle.Color  = "Gris";
            expectedVehicle.Type   = "Auto";
            expectedVehicle.Vin    = "TEST1234";
            expectedVehicle.Id     = Guid.NewGuid();
            expectedVehicle.Status = StatusCode.InPort;
            VehicleDAO vehicleDAO   = new VehicleDAOImpl();
            VehicleDTO vehicleExist = vehicleDAO.FindVehicleByVin(expectedVehicle.Vin);
            bool       isAssigned   = false;

            if (vehicleExist == null)
            {
                vehicleDAO.AddVehicle(expectedVehicle);
            }
            else
            {
                isAssigned = vehicleDAO.IsAssigned("TEST1234");
            }
            return(isAssigned);
        }
Пример #2
0
        private VehicleDTO CreateVehicle()
        {
            VehicleDTO expectedVehicle = new VehicleDTO();


            VehicleDAO vehicleDAO   = new VehicleDAOImpl();
            VehicleDTO vehicleExist = vehicleDAO.FindVehicleByVin(expectedVehicle.Vin);

            if (vehicleExist == null)
            {
                vehicleDAO.AddVehicle(expectedVehicle);
            }
            return(expectedVehicle);
        }
Пример #3
0
        public void DeleteVehicleTest()
        {
            VehicleDTO expectedVehicle = CreateVehicle("TEST123");
            VehicleDAO vehicleDAO      = new VehicleDAOImpl();
            VehicleDTO resultVehicle   = vehicleDAO.FindVehicleByVin("TEST123");

            if (resultVehicle == null)
            {
                vehicleDAO.AddVehicle(expectedVehicle);
            }
            vehicleDAO.DeleteVehicleByVin("TEST123");

            resultVehicle = vehicleDAO.FindVehicleByVin("TEST123");

            Assert.IsNull(resultVehicle);
        }
Пример #4
0
        public void PersistVehicleTest()
        {
            VehicleDTO expectedVehicle = CreateVehicle("TEST1");

            VehicleDAO vehicleDAO = new VehicleDAOImpl();

            vehicleDAO.AddVehicle(expectedVehicle);
            VehicleDTO resultVehicle = vehicleDAO.FindVehicleByVin("TEST1");

            Assert.AreEqual(expectedVehicle.Brand, resultVehicle.Brand);
            Assert.AreEqual(expectedVehicle.Model, resultVehicle.Model);
            Assert.AreEqual(expectedVehicle.Year, resultVehicle.Year);
            Assert.AreEqual(expectedVehicle.Color, resultVehicle.Color);
            Assert.AreEqual(expectedVehicle.Type, resultVehicle.Type);
            Assert.AreEqual(expectedVehicle.Vin, resultVehicle.Vin);
            Assert.AreEqual(expectedVehicle.Status, resultVehicle.Status);
        }
Пример #5
0
        private VehicleDTO CreateVehicle()
        {
            VehicleDTO expectedVehicle = new VehicleDTO();

            expectedVehicle.Brand = "Chevrolet";
            expectedVehicle.Color = "Gris";
            expectedVehicle.Model = "Onyx";
            expectedVehicle.Type  = "Auto";
            expectedVehicle.Vin   = "TEST1234";
            expectedVehicle.Year  = 2016;

            VehicleDAO vehicleDAO   = new VehicleDAOImpl();
            VehicleDTO vehicleExist = vehicleDAO.FindVehicleByVin(expectedVehicle.Vin);

            if (vehicleExist == null)
            {
                vehicleDAO.AddVehicle(expectedVehicle);
            }
            return((vehicleExist == null) ? expectedVehicle : vehicleExist);
        }
Пример #6
0
        public void UpdateVehicleTest()
        {
            VehicleDTO expectedVehicle = CreateVehicle("TEST12");
            VehicleDAO vehicleDAO      = new VehicleDAOImpl();
            VehicleDTO resultVehicle   = vehicleDAO.FindVehicleByVin("TEST12");

            if (resultVehicle == null)
            {
                vehicleDAO.AddVehicle(expectedVehicle);
            }

            expectedVehicle.Color = "Azul";

            vehicleDAO.UpdateVehicle(expectedVehicle);

            resultVehicle = vehicleDAO.FindVehicleByVin("TEST12");

            Assert.AreEqual(expectedVehicle.Color, resultVehicle.Color);

            vehicleDAO.DeleteVehicleByVin("TEST12");
        }
Пример #7
0
        public void AssignVehicleTest()
        {
            ZoneDAO    zoneDAO         = new ZoneDAOImp();
            ZoneDTO    zoneDTO         = createZone("Zona 1");
            VehicleDTO expectedVehicle = CreateVehicle("TEST123456");
            VehicleDAO vehicleDAO      = new VehicleDAOImpl();
            VehicleDTO resultVehicle   = vehicleDAO.FindVehicleByVin("TEST123456");

            if (resultVehicle == null)
            {
                vehicleDAO.AddVehicle(expectedVehicle);
            }

            Guid idZone = zoneDAO.CreateZone(zoneDTO);

            zoneDAO.AssignVehicle(idZone, expectedVehicle.Vin);

            ZoneDTO resultZone = zoneDAO.FindZoneById(idZone);

            Assert.AreEqual(resultZone.Vehicles.ElementAt(0).Vin, expectedVehicle.Vin);
        }
Пример #8
0
        private List <VehicleDTO> CreateVehicles()
        {
            List <VehicleDTO> vehicles = new List <VehicleDTO>();
            VehicleDTO        vehicle  = new VehicleDTO();

            vehicle.Brand  = "Chevrolet";
            vehicle.Model  = "Onyx";
            vehicle.Year   = 2016;
            vehicle.Color  = "Gris";
            vehicle.Type   = "Auto";
            vehicle.Vin    = "TEST1234";
            vehicle.Id     = Guid.NewGuid();
            vehicle.Status = StatusCode.InPort;

            VehicleDAO vehicleDAO = new VehicleDAOImpl();

            vehicleDAO.AddVehicle(vehicle);

            vehicles.Add(vehicle);

            return(vehicles);
        }