public async Task GetAllTrucksByUserIdAsync_WithNullUser_ShouldReturnArgumentNullException() { var context = SteuDbContextInMemoryFactory.InitializeContext(); TrucksService service = IntializeLoadService(context); var repository = new EfDeletableEntityRepository <Order>(context); var order = new Order() { Id = "orderId", IsDeleted = false, ExpireTime = DateTime.UtcNow.AddDays(7), Truck = new Truck(), SteuUser = new SteuUser() { Id = "userId", }, }; await repository.AddAsync(order); await repository.SaveChangesAsync(); await Assert.ThrowsAsync <ArgumentNullException>(() => service.GetAllTrucksByUserIdAsync(1, 10, null)); }
public async Task GetAllTrucksByUserIdAsync_WithNonUserLoad_ShouldReturnEmptyList() { var context = SteuDbContextInMemoryFactory.InitializeContext(); TrucksService service = IntializeLoadService(context); var repository = new EfDeletableEntityRepository <Order>(context); var order = new Order() { Id = "orderId", IsDeleted = false, ExpireTime = DateTime.UtcNow.AddDays(7), Truck = new Truck(), SteuUser = new SteuUser() { Id = "userId", }, }; await repository.AddAsync(order); await repository.SaveChangesAsync(); var actualResult = await service.GetAllTrucksByUserIdAsync(1, 10, "asdasd"); Assert.Empty(actualResult); }