public void RemoveAsync_ReturnsFalse() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { var phonesService = new PhonesService(dbContext); var result = phonesService.RemoveAsync(1); Assert.False(result.Result); } }
public void RemoveAsync_ReturnsTrue() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { Phone phone = new Phone() { PhoneNumber = "0897248721" }; var phonesService = new PhonesService(dbContext); dbContext.Phones.Add(phone); dbContext.SaveChanges(); var result = phonesService.RemoveAsync(1); Assert.True(result.Result); } }