public async Task EditTruckAsync_WithIncorectOrderId_ShouldReturnArgumentNullException() { var context = SteuDbContextInMemoryFactory.InitializeContext(); TrucksService service = IntializeLoadService(context); var repository = new EfDeletableEntityRepository <Order>(context); await repository.AddAsync(new Order() { Id = "asdasd", Truck = new Truck(), }); await context.SaveChangesAsync(); EditTruckViewModel model = new EditTruckViewModel() { Id = "asd", CountryFrom = "Bulgaria", TownFrom = "Sofia", CountryTo = "Croatia", TownTo = "Zagreb", TruckTypeName = "Normal", Priority = "Normal", Circle = false, ExpireTime = DateTime.UtcNow, LoadTime = DateTime.UtcNow, MaxVolume = 100, MaxLoad = 20000, Price = 12312231, Referer = "dasada", InputModel = new TruckEditViewModel(), }; await Assert.ThrowsAsync <ArgumentNullException>(() => service.EditTruckAsync(model)); }
public async Task EditTruckAsync_WithCorrectData_ShouldEditTruck() { var context = SteuDbContextInMemoryFactory.InitializeContext(); TrucksService service = IntializeLoadService(context); var repository = new EfDeletableEntityRepository <Order>(context); await repository.AddAsync(new Order() { Id = "asdasd", Truck = new Truck(), }); await context.SaveChangesAsync(); EditTruckViewModel model = new EditTruckViewModel() { Id = "asdasd", CountryFrom = "Bulgaria", TownFrom = "Sofia", CountryTo = "Croatia", TownTo = "Zagreb", TruckTypeName = "Normal", Priority = "Normal", Circle = false, ExpireTime = DateTime.UtcNow, LoadTime = DateTime.UtcNow, MaxVolume = 100, MaxLoad = 20000, Price = 12312231, Referer = "dasada", InputModel = new TruckEditViewModel(), }; await service.EditTruckAsync(model); var actualResult = await repository.All().ToListAsync(); Assert.Equal(12312231, actualResult[0].Price); }