public void CreateInspectionSuccessfullyTest() { 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; var mockInspectionDAO = new Mock <InspectionDAO>(); mockInspectionDAO.Setup(vs => vs.FindInspectionById(inspection.Id)).Returns(inspection); var mockVehicleDAO = new Mock <VehicleDAO>(); mockVehicleDAO.Setup(vs => vs.FindVehicleByVin(inspection.IdVehicle)).Returns(vehicle); var inspectionService = new InspectionServiceImpl(mockInspectionDAO.Object, mockVehicleDAO.Object); Guid id = inspectionService.CreateInspection(inspection); InspectionDTO resultInspection = inspectionService.FindInspectionById(inspection.Id); Assert.AreEqual(inspection.CreatorUserName, resultInspection.CreatorUserName); Assert.AreEqual(inspection.Date, resultInspection.Date); Assert.AreEqual(inspection.Id, resultInspection.Id); Assert.AreEqual(inspection.Location, resultInspection.Location); Assert.AreEqual(inspection.IdVehicle, resultInspection.IdVehicle); foreach (DamageDTO damage in inspection.Damages) { Assert.IsNotNull(resultInspection.Damages.Find(d => d.Description == damage.Description)); } }