public void JSONEngineRepository_GetById_Test() { //Arrange var engineRepo = new JSONBaseRepository <Engine>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\engines_tests.json"); var engineToAdd = new Engine { }; engineRepo.AddEntity(engineToAdd); var engine = engineRepo.GetById(engineToAdd.Id.ToString()); //Act var retrievedEngine = engineRepo.GetById(engineToAdd.Id.ToString()); //Assert Assert.True(engine.Equals(retrievedEngine)); }
public void JSONCustomerRepository_GetById_Test() { //Arrange var customerRepo = new JSONBaseRepository <Customer>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\customers_tests.json"); var customerToAdd = new Customer { }; customerRepo.AddEntity(customerToAdd); var customer = customerRepo.GetById(customerToAdd.Id.ToString()); //Act var retrievedCustomer = customerRepo.GetById(customerToAdd.Id.ToString()); //Assert Assert.True(customer.Equals(retrievedCustomer)); }
public void JSONVehicleRepository_GetById_Test() { //Arrange var vehicleRepo = new JSONBaseRepository <Vehicle>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\vehicles_tests.json"); var vehicleToAdd = new Vehicle { }; vehicleRepo.AddEntity(vehicleToAdd); var vehicle = vehicleRepo.GetById(vehicleToAdd.Id.ToString()); //Act var retrievedVehicle = vehicleRepo.GetById(vehicleToAdd.Id.ToString()); //Assert Assert.True(vehicle.Equals(retrievedVehicle)); }
public void JSONGearboxRepository_GetById_Test() { //Arrange var gearboxRepo = new JSONBaseRepository <GearBox>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\gearboxes_tests.json"); var gearboxToAdd = new GearBox { Type = Enums.GearBoxTypeEnum.Manual }; gearboxRepo.AddEntity(gearboxToAdd); var engine = gearboxRepo.GetById(gearboxToAdd.Id.ToString()); //Act var retrievedGearbox = gearboxRepo.GetById(gearboxToAdd.Id.ToString()); //Assert Assert.True(engine.Equals(retrievedGearbox)); }
public void JSONCustomerRepository_DeleteEntity_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 toDelete = customers[0]; //Act customerRepo.DeleteById(toDelete.Id.ToString()); //Assert Assert.True(customerRepo.GetById(toDelete.Id.ToString()) == null); }
public void JSONGearboxRepository_DeleteEntity_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 toDelete = gearboxes[0]; //Act gearboxRepo.DeleteById(toDelete.Id.ToString()); //Assert Assert.True(gearboxRepo.GetById(toDelete.Id.ToString()) == null); }
public void JSONCustomerRepository_Insert_Test() { //Arrange var customerRepo = new JSONBaseRepository <Customer>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\customers_tests.json"); var customer = new Customer { Name = "Cristina Golban" }; //Act customerRepo.AddEntity(customer); //retrieve from db var retrievedCustomer = customerRepo.GetById(customer.Id.ToString()); //Assert Assert.True(customer.Equals(retrievedCustomer)); }
public void JSONGearboxRepository_Insert_Test() { //Arrange var gearboxRepo = new JSONBaseRepository <GearBox>(@"D:\Projects\OOP Principles\VehicleShowRoom\VehicleIndustry.Dal\JSONdatabase\Tests\gearboxes_tests.json"); var gearbox = new GearBox { Type = Enums.GearBoxTypeEnum.Automatic }; //Act gearboxRepo.AddEntity(gearbox); //retrieve from db var retrievedGearbox = gearboxRepo.GetById(gearbox.Id.ToString()); //Assert Assert.True(gearbox.Equals(retrievedGearbox)); }