public async Task CreateTruckAsyncTest_WithNullModelPropery_ShouldReturnArgumentNullException() { var context = SteuDbContextInMemoryFactory.InitializeContext(); TrucksService service = IntializeLoadService(context); AddTrucksInputModel model = new AddTrucksInputModel() { CountryFrom = null, TownFrom = "Sofia", CountryTo = "Croatia", TownTo = "Zagreb", TruckTypeName = "Normal", SteuUserId = "asdasd", Priority = "Normal", Circle = false, ExpireTime = DateTime.UtcNow, InputModel = new TruckCreateViewModel(), LoadTime = DateTime.UtcNow, MaxVolume = 100, MaxLoad = 20000, Price = 12312231, Referer = "dasada", }; await Assert.ThrowsAsync <ArgumentNullException>(() => service.CreateTruckAsync(model, "asdasd")); }
public async Task CreateTruckAsyncTest_WithCorrectData_ShouldReturnTruck() { var context = SteuDbContextInMemoryFactory.InitializeContext(); TrucksService service = IntializeLoadService(context); var repository = new EfDeletableEntityRepository <Order>(context); AddTrucksInputModel model = new AddTrucksInputModel() { CountryFrom = "Bulgaria", TownFrom = "Sofia", CountryTo = "Croatia", TownTo = "Zagreb", TruckTypeName = "Normal", SteuUserId = "asdasd", Priority = "Normal", Circle = false, ExpireTime = DateTime.UtcNow, InputModel = new TruckCreateViewModel(), LoadTime = DateTime.UtcNow, MaxVolume = 100, MaxLoad = 20000, Price = 12312231, Referer = "dasada", }; await service.CreateTruckAsync(model, "asdasd"); var actualResult = await repository.All().ToListAsync(); Assert.Single(actualResult); }