public async Task Removes_Existing_Item() { var model = new Service { ServiceId = "Removes_Existing_Item", DisplayName = "Test Service" }; using (var context = new RegistryDbContext(DbContextOptions, StoreOptions)) { context.Services.Add(model.ToEntity()); context.SaveChanges(); } using (var context = new RegistryDbContext(DbContextOptions, StoreOptions)) { var store = new ServiceStore(context, new Mock <ILogger <ServiceStore> >().Object); await store.RemoveAsync(model.ServiceId); } using (var context = new RegistryDbContext(DbContextOptions, StoreOptions)) { context.Services.SingleOrDefault(s => s.ServiceId == model.ServiceId).Should().BeNull(); } }
public void Does_Not_Throw_On_NonExisting_Item() { using (var context = new RegistryDbContext(DbContextOptions, StoreOptions)) { var store = new ServiceStore(context, new Mock <ILogger <ServiceStore> >().Object); Func <Task> action = async() => await store.RemoveAsync("anyserviceid"); action.Should().NotThrow(); } }