public async Task AddAsyncShouldThrowAgrumentNullForInvalidUser() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "AddAsyncShouldWork").Options; var dbContext = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Message>(dbContext); var service = new MessagesService(repository); await Assert.ThrowsAsync <ArgumentNullException>(() => service.AddAsync("random", null)); }
public async Task AddAsyncShouldWork() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "AddAsyncShouldWork").Options; var dbContext = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Message>(dbContext); var service = new MessagesService(repository); await service.AddAsync("content", new ApplicationUser()); Assert.Single(service.GetAll()); }