Exemplo n.º 1
0
        public void PersistInspectionTest()
        {
            InspectionDAO inspectionDAO = new InspectionDAOImp(new VehicleDAOImpl());
            UserDAO       userDAO       = new UserDAOImp();

            List <DamageDTO> damages = this.CreateDamages();
            UserDTO          user    = this.CreateUser();
            VehicleDTO       vehicle = this.CreateVehicle();

            InspectionDTO inspection = new InspectionDTO();

            inspection.Damages         = damages;
            inspection.CreatorUserName = user.UserName;
            inspection.Date            = DateTime.Now;
            inspection.Location        = "Puerto 1";
            inspection.IdVehicle       = vehicle.Vin;

            Guid id = inspectionDAO.AddInspection(inspection);

            InspectionDTO resultInspection = inspectionDAO.FindInspectionById(inspection.Id);

            Assert.AreEqual(inspection.CreatorUserName, resultInspection.CreatorUserName);
            Assert.AreEqual(inspection.Id, resultInspection.Id);
            Assert.AreEqual(inspection.Location, resultInspection.Location);
            foreach (DamageDTO damage in inspection.Damages)
            {
                Assert.IsNotNull(resultInspection.Damages.Find(d => d.Description == damage.Description));
            }
        }
Exemplo n.º 2
0
        public void ExistVehicleInspectionTest()
        {
            InspectionDAO inspectionDAO = new InspectionDAOImp(new VehicleDAOImpl());
            UserDAO       userDAO       = new UserDAOImp();

            List <DamageDTO> damages = this.CreateDamages();
            UserDTO          user    = this.CreateUser();
            VehicleDTO       vehicle = this.CreateVehicle();

            InspectionDTO inspection = new InspectionDTO();

            inspection.Damages         = damages;
            inspection.CreatorUserName = user.UserName;
            inspection.Date            = DateTime.Now;
            inspection.Location        = "Puerto 1";
            inspection.IdVehicle       = vehicle.Vin;

            Guid id = inspectionDAO.AddInspection(inspection);

            Assert.IsTrue(inspectionDAO.ExistVehicleInspection(vehicle.Vin));
        }