public async void ItShouldFindTheInventoryByLocationAndProductname() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); //When await locationRepo.AddLocationInventory(mockLocationInventory); //Then LocationInventory actualLocationInventory = await locationRepo.GetLocationInventoryByProductAndLocationName(mockLocation.Name, mockProduct.Name); Assert.Equal(1, actualLocationInventory.Quanitity); }
public async void ItShouldRemoveLocationInventoryRecord() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); //When LocationInventory tempLocationInventory = await locationRepo.AddLocationInventory(mockLocationInventory); await locationRepo.RemoveLocationInventoryRecord(tempLocationInventory.ID); //Then Assert.Empty(await locationRepo.GetAllLocationInventoryRecords()); }
public async void ItShouldRestockInventory() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); //When await locationRepo.AddLocationInventory(mockLocationInventory); await locationRepo.RemoveInventory(-1, mockLocation.Name, mockProduct.Name); //Then LocationInventory actualLocationInventory = await locationRepo.GetLocationInventoryByProductAndLocationName(mockLocation.Name, mockProduct.Name); Assert.Equal(2, actualLocationInventory.Quanitity); }
public async void ItShouldCreateALocation() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); Location newLocation = new Location { Name = "location" }; //When await locationRepo.Add(newLocation); //Then Location actualLocation = (await locationRepo.GetAll()).ElementAt(0); Assert.Equal("location", actualLocation.Name); }
public async void ItShouldRemoveALocation() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); Location newLocation = new Location { Name = "location" }; //When await locationRepo.Add(newLocation); Location tempLocation = (await locationRepo.GetAll()).ElementAt(0); await locationRepo.Delete(tempLocation.ID); //Then Assert.Equal(0, (await locationRepo.GetAll()).Count()); }
public LocationController(IRepository <Location> repository) { locationRepo = repository as EFCoreLocationRepository; }