public void JSONCustomerRepository_UpdateEnity_Test() { //Arrange var customerRepo = new JSONBaseRepository <Customer>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\customers_tests.json"); var customers = customerRepo.GetAll().ToList(); var toUpdate = customers[0]; //Act customerRepo.UpdateEntity(toUpdate.Id.ToString(), new Customer { Name = "Cristina Golban" }); var retrievedCustomers = customerRepo.GetAll().ToList(); bool rez = false; for (int i = 0; i < customers.Count(); i++) { if (!customers[i].Equals(retrievedCustomers[i])) { rez = true; break; } } //Assert Assert.True(rez); }
public void JSONGearboxRepository_UpdateEnity_Test() { //Arrange var gearboxRepo = new JSONBaseRepository <GearBox>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\gearboxes_tests.json"); var gearboxes = gearboxRepo.GetAll().ToList(); var toUpdate = gearboxes[0]; //Act gearboxRepo.UpdateEntity(toUpdate.Id.ToString(), new GearBox { Type = Enums.GearBoxTypeEnum.Automatic }); var retrievedVehicles = gearboxRepo.GetAll().ToList(); bool rez = false; for (int i = 0; i < gearboxes.Count(); i++) { if (!gearboxes[i].Equals(retrievedVehicles[i])) { rez = true; break; } } //Assert Assert.True(rez); }
public void JSONEngineRepository_UpdateEnity_Test() { //Arrange var engineRepo = new JSONBaseRepository <Engine>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\engines_tests.json"); var engines = engineRepo.GetAll().ToList(); var toUpdate = engines[0]; //Act engineRepo.UpdateEntity(toUpdate.Id.ToString(), new Engine { HP = 931 }); var retrievedEngine = engineRepo.GetAll().ToList(); bool rez = false; for (int i = 0; i < engines.Count(); i++) { if (!engines[i].Equals(retrievedEngine[i])) { rez = true; break; } } //Assert Assert.True(rez); }
public void JSONVehicleRepository_UpdateEnity_Test() { //Arrange var vehicleRepo = new JSONBaseRepository <Vehicle>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\vehicles_tests.json"); var vehicles = vehicleRepo.GetAll().ToList(); var toUpdate = vehicles[0]; //Act vehicleRepo.UpdateEntity(toUpdate.Id.ToString(), new Vehicle { Brand = "Lamborgini", Model = "1" }); var retrievedVehicles = vehicleRepo.GetAll().ToList(); bool rez = false; for (int i = 0; i < vehicles.Count(); i++) { if (!vehicles[i].Equals(retrievedVehicles[i])) { rez = true; break; } } //Assert Assert.True(rez); }