public void GetMakeByIdShouldThrowErrorForNotExistingMake() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "GetMakeByIdShouldThrowErrorForNotExistingMake").Options; var dbContext = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Make>(dbContext); var service = new MakesService(repository); Assert.Throws <ArgumentNullException>(() => service.GetMakeById(1)); }
public async Task GetMakeByIdShouldWork() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "GetMakeByIdShouldWork").Options; var dbContext = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Make>(dbContext); var service = new MakesService(repository); await service.AddAsync("BMW"); Assert.Equal("BMW", service.GetMakeById(1).Name); }