public async Task GetTruckDetailsByIdAsync_WithNullOrderId_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 = "asdasd", FirstName = "Pesho", }, }; await repository.AddAsync(order); await repository.SaveChangesAsync(); await Assert.ThrowsAsync <ArgumentNullException>(() => service.GetTruckDetailsByIdAsync <DetailsTruckViewModel>(null)); }
public async Task GetTruckDetailsByIdAsync_WithCorrectData_ShouldReturnDetailsTruckViewModel() { 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 = "asdasd", FirstName = "Pesho", }, }; await repository.AddAsync(order); await repository.SaveChangesAsync(); var actualresutlt = await service.GetTruckDetailsByIdAsync <DetailsTruckViewModel>("orderId"); Assert.Equal("Pesho", actualresutlt.SteuUserFirstName); }