public async Task TestSoftDeleteServiceSetSoftDddDeleteViaKeysOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var bookDdd = new BookDDD("Test"); context.Add(bookDdd); context.SaveChanges(); var config = new ConfigSoftDeleteDDD(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDeletedDDD>(config); //ATTEMPT var status = await service.SetSoftDeleteViaKeysAsync <BookDDD>(bookDdd.Id); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); } using (var context = new SingleSoftDelDbContext(options)) { context.BookDdds.Count().ShouldEqual(0); context.BookDdds.IgnoreQueryFilters().Count().ShouldEqual(1); } }
public void TestHardDeleteSoftDeletedEntryNoCallSaveChangesOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book = context.AddBookWithReviewToDb(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); var status = service.SetSoftDelete(book); status.IsValid.ShouldBeTrue(status.GetAllErrors()); } using (var context = new SingleSoftDelDbContext(options)) { var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); //ATTEMPT var status = service.HardDeleteSoftDeletedEntry(context.Books.IgnoreQueryFilters().Single(), false); context.Books.IgnoreQueryFilters().Count().ShouldEqual(1); context.SaveChanges(); context.Books.IgnoreQueryFilters().Count().ShouldEqual(0); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); } }
public async Task TestSoftDeleteAsyncOrderWithAddressOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using var context = new SingleSoftDelDbContext(options); context.Database.EnsureCreated(); context.Add(new Order { OrderRef = "123", UserAddress = new Address { FullAddress = "xxx" } }); context.SaveChanges(); context.ChangeTracker.Clear(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var status = await service.SetSoftDeleteViaKeysAsync <Order>(1); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); context.Orders.Count().ShouldEqual(0); context.Addresses.Count().ShouldEqual(1); }
public void TestSoftDeleteServiceGetSoftDeletedEntriesOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book1 = context.AddBookWithReviewToDb("test1"); var book2 = context.AddBookWithReviewToDb("test2"); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); var status = service.SetSoftDelete(book1); status.IsValid.ShouldBeTrue(status.GetAllErrors()); } using (var context = new SingleSoftDelDbContext(options)) { var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); //ATTEMPT var softDelBooks = service.GetSoftDeletedEntries <Book>().ToList(); //VERIFY softDelBooks.Count.ShouldEqual(1); softDelBooks.Single().Title.ShouldEqual("test1"); context.Books.Count().ShouldEqual(1); context.Books.IgnoreQueryFilters().Count().ShouldEqual(2); } }
public void TestSoftDeleteServiceResetSoftDeleteViaKeysOk() { //SETUP int bookId; var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); bookId = context.AddBookWithReviewToDb().Id; var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); var status1 = service.SetSoftDeleteViaKeys <Book>(bookId); status1.IsValid.ShouldBeTrue(status1.GetAllErrors()); //ATTEMPT var status2 = service.ResetSoftDeleteViaKeys <Book>(bookId); //VERIFY status2.IsValid.ShouldBeTrue(status2.GetAllErrors()); status2.Result.ShouldEqual(1); } using (var context = new SingleSoftDelDbContext(options)) { context.Books.Count().ShouldEqual(1); context.Books.IgnoreQueryFilters().Count().ShouldEqual(1); } }
public ConfigSoftDeleteWithUserId(SingleSoftDelDbContext context) : base(context) { GetSoftDeleteValue = entity => entity.SoftDeleted; SetSoftDeleteValue = (entity, value) => { entity.SoftDeleted = value; }; OtherFilters.Add(typeof(IUserId), entity => ((IUserId)entity).UserId == context.UserId); }
public void TestAddBookWithReviewOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); //ATTEMPT context.AddBookWithReviewToDb(); context.ChangeTracker.Clear(); //VERIFY var book = context.Books .Include(x => x.Reviews) .Include(x => x.OneToOneRelationship) .Single(); book.Title.ShouldEqual("test"); book.OneToOneRelationship.ShouldNotBeNull(); book.Reviews.ShouldNotBeNull(); book.Reviews.Single().NumStars.ShouldEqual(1); } }
public void TestSetSoftDeleteOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using var context = new SingleSoftDelDbContext(options); context.Database.EnsureCreated(); var shadowClass = new ShadowDelClass(); context.Add(shadowClass); context.SaveChanges(); context.ChangeTracker.Clear(); var config = new ConfigSoftDeleteShadowDel(context); var service = new SingleSoftDeleteService <IShadowSoftDelete>(config); //ATTEMPT var status = service.SetSoftDeleteViaKeys <ShadowDelClass>(shadowClass.Id); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); context.ShadowDelClasses.Count().ShouldEqual(0); context.ShadowDelClasses.IgnoreQueryFilters().Count().ShouldEqual(1); }
public ConfigSoftDeleteShadowDel(SingleSoftDelDbContext context) : base(context) { GetSoftDeleteValue = entity => (bool)context.Entry(entity).Property("SoftDeleted").CurrentValue; QuerySoftDeleteValue = entity => EF.Property <bool>(entity, "SoftDeleted"); SetSoftDeleteValue = (entity, value) => context.Entry(entity).Property("SoftDeleted").CurrentValue = value; }
public async Task TestSoftDeleteServiceSetSoftDeleteOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book = context.AddBookWithReviewToDb(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var status = await service.SetSoftDeleteAsync(book); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); } using (var context = new SingleSoftDelDbContext(options)) { context.Books.Count().ShouldEqual(0); context.Books.IgnoreQueryFilters().Count().ShouldEqual(1); } }
public void TestRegisterServiceViaProvidedMethodTestOk() { //SETUP var options1 = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); var context1 = new SingleSoftDelDbContext(options1); var options2 = SqliteInMemory.CreateOptions <CascadeSoftDelDbContext>(); var context2 = new CascadeSoftDelDbContext(options2); //ATTEMPT var services = new ServiceCollection(); services.AddScoped(x => context1); services.AddScoped(x => context2); var logs = services.RegisterSoftDelServicesAndYourConfigurations(); var serviceProvider = services.BuildServiceProvider(); //VERIFY foreach (var log in logs) { _output.WriteLine(log); } var service1 = serviceProvider.GetRequiredService <SingleSoftDeleteService <ISingleSoftDelete> >(); var service2 = serviceProvider.GetRequiredService <SingleSoftDeleteService <ISingleSoftDeletedDDD> >(); var service3 = serviceProvider.GetRequiredService <CascadeSoftDelService <ICascadeSoftDelete> >(); }
public void TestCanFilterUsingAccessorOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book = new Book { Title = "test", SoftDeleted = true }; context.Add(book); context.SaveChanges(); var config = new ConfigSoftDeleteWithUserId(context); //ATTEMPT var getSoftValue = config.GetSoftDeleteValue.Compile().Invoke(book); getSoftValue.ShouldBeTrue(); var query = context.Books.IgnoreQueryFilters().Where(config.GetSoftDeleteValue).Cast <Book>() .Select(x => x.Title.Length); var result = query.ToList(); //VERIFY _output.WriteLine(query.ToQueryString()); result.Count.ShouldEqual(1); } }
public void TestSoftDeleteServiceDddResetSoftDeleteOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); context.Database.EnsureCreated(); var bookDdd = new BookDDD("Test"); context.Add(bookDdd); context.SaveChanges(); var config = new ConfigSoftDeleteDDD(context); var service = new SingleSoftDeleteService <ISingleSoftDeletedDDD>(config); service.SetSoftDelete(bookDdd); //ATTEMPT var status = service.ResetSoftDelete(bookDdd); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); context.ChangeTracker.Clear(); context.BookDdds.Count().ShouldEqual(1); context.BookDdds.IgnoreQueryFilters().Count().ShouldEqual(1); } }
public static Book AddBookWithReviewToDb(this SingleSoftDelDbContext context, string title = "test") { var book = new Book { Title = title, Reviews = new List <Review> { new Review { NumStars = 1 } } }; context.Add(book); context.SaveChanges(); return(book); }
public void TestHardDeleteViaKeysWithUserIdOk() { //SETUP var currentUser = Guid.NewGuid(); int orderId; var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); options.StopNextDispose(); using (var context = new SingleSoftDelDbContext(options, currentUser)) { context.Database.EnsureCreated(); var order1 = new Order { OrderRef = "Cur user Order, soft del", SoftDeleted = true, UserId = currentUser }; var order2 = new Order { OrderRef = "Cur user Order", SoftDeleted = false, UserId = currentUser }; var order3 = new Order { OrderRef = "Diff user Order", SoftDeleted = true, UserId = Guid.NewGuid() }; var order4 = new Order { OrderRef = "Diff user Order", SoftDeleted = false, UserId = Guid.NewGuid() }; context.AddRange(order1, order2, order3, order4); context.SaveChanges(); orderId = order1.Id; } using (var context = new SingleSoftDelDbContext(options, currentUser)) { var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(config); //ATTEMPT var status = service.ResetSoftDeleteViaKeys <Order>(orderId); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); context.ChangeTracker.Clear(); context.Orders.IgnoreQueryFilters().Count().ShouldEqual(4); context.Orders.Count().ShouldEqual(2); } }
public void TestSoftDeleteServiceGetSoftDeletedEntriesWithUserIdOk() { //SETUP var currentUser = Guid.NewGuid(); var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options, currentUser)) { context.Database.EnsureCreated(); var order1 = new Order { OrderRef = "Cur user Order, soft del", SoftDeleted = true, UserId = currentUser }; var order2 = new Order { OrderRef = "Cur user Order", SoftDeleted = false, UserId = currentUser }; var order3 = new Order { OrderRef = "Diff user Order", SoftDeleted = true, UserId = Guid.NewGuid() }; var order4 = new Order { OrderRef = "Diff user Order", SoftDeleted = false, UserId = Guid.NewGuid() }; context.AddRange(order1, order2, order3, order4); context.SaveChanges(); context.ChangeTracker.Clear(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(config); //ATTEMPT var orders = service.GetSoftDeletedEntries <Order>().ToList(); //VERIFY orders.Count.ShouldEqual(1); context.ChangeTracker.Clear(); orders.Single(x => x.UserId == currentUser).OrderRef.ShouldEqual("Cur user Order, soft del"); context.Orders.IgnoreQueryFilters().Count().ShouldEqual(4); var all = context.Orders.IgnoreQueryFilters().ToList(); context.Orders.Count().ShouldEqual(1); } }
public void TestHardDeleteViaKeysWithWrongUserIdBad() { //SETUP var currentUser = Guid.NewGuid(); int bookId; var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var order1 = new Order { OrderRef = "Cur user Order, soft del", SoftDeleted = true, UserId = currentUser }; var order2 = new Order { OrderRef = "Cur user Order", SoftDeleted = false, UserId = currentUser }; var order3 = new Order { OrderRef = "Diff user Order", SoftDeleted = true, UserId = Guid.NewGuid() }; var order4 = new Order { OrderRef = "Diff user Order", SoftDeleted = false, UserId = Guid.NewGuid() }; context.AddRange(order1, order2, order3, order4); context.SaveChanges(); bookId = order3.Id; } using (var context = new SingleSoftDelDbContext(options, currentUser)) { var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); //ATTEMPT var status = service.ResetSoftDeleteViaKeys <Order>(bookId); //VERIFY status.IsValid.ShouldBeFalse(); status.GetAllErrors().ShouldEqual("Could not find the entry you ask for."); context.Orders.IgnoreQueryFilters().Count().ShouldEqual(4); context.Orders.Count().ShouldEqual(1); } }
public void TestBadConfigurationOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var config = new BadConfig(context); //ATTEMPT var ex = Assert.Throws <InvalidOperationException>(() => new SingleSoftDeleteService <ISingleSoftDelete>(config)); //VERIFY ex.Message.ShouldEqual("You must set the GetSoftDeleteValue with a query to get the soft delete bool"); } }
public void TestRegisterServiceManuallyOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); var context = new SingleSoftDelDbContext(options); //ATTEMPT var services = new ServiceCollection(); services.AddScoped(x => context); services.AddSingleton <SingleSoftDeleteConfiguration <ISingleSoftDelete>, ConfigSoftDeleteWithUserId>(); services.AddTransient <SingleSoftDeleteService <ISingleSoftDelete> >(); var serviceProvider = services.BuildServiceProvider(); //VERIFY var service1 = serviceProvider.GetRequiredService <SingleSoftDelDbContext>(); var service2 = serviceProvider.GetRequiredService <SingleSoftDeleteConfiguration <ISingleSoftDelete> >(); var service3 = serviceProvider.GetRequiredService <SingleSoftDeleteService <ISingleSoftDelete> >(); }
public void TestManuallySoftDeleteOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using var context = new SingleSoftDelDbContext(options); context.Database.EnsureCreated(); var shadowClass = new ShadowDelClass(); context.Add(shadowClass); context.SaveChanges(); //ATTEMPT context.Entry(shadowClass).Property("SoftDeleted").CurrentValue = true; context.SaveChanges(); //VERIFY context.ShadowDelClasses.Count().ShouldEqual(0); context.ShadowDelClasses.IgnoreQueryFilters().Count().ShouldEqual(1); }
public async Task TestSoftDeleteServiceSetSoftDeleteViaKeysBadNumberOfKeys() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book = context.AddBookWithReviewToDb(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var ex = await Assert.ThrowsAsync <ArgumentException>(async() => await service.SetSoftDeleteViaKeysAsync <Book>(1, 2)); //VERIFY ex.Message.ShouldEqual("Mismatch in keys: your provided 2 key(s) and the entity has 1 key(s) (Parameter 'keyValues')"); } }
public async Task TestSoftDeleteServiceSetSoftDeleteViaKeysBadKeyType() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book = context.AddBookWithReviewToDb(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var ex = await Assert.ThrowsAsync <ArgumentException>(async() => await service.SetSoftDeleteViaKeysAsync <Book>(book)); //VERIFY ex.Message.ShouldEqual("Mismatch in keys: your provided key 1 (of 1) is of type Book but entity key's type is System.Int32 (Parameter 'keyValues')"); } }
public async Task TestSoftDeleteServiceSetSoftDeleteOneToOneBad() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); context.AddBookWithReviewToDb(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var ex = await Assert.ThrowsAsync <InvalidOperationException>(async() => await service.SetSoftDeleteViaKeysAsync <OneToOne>(1)); //VERIFY ex.Message.ShouldEqual("You cannot soft delete a one-to-one relationship. It causes problems if you try to create a new version."); } }
public async Task TestQueryBookWithReviewsOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); context.AddBookWithReviewToDb(); //ATTEMPT var query = context.Books.Include(x => x.Reviews); var book = await query.SingleAsync(); //VERIFY _output.WriteLine(query.ToQueryString()); book.Title.ShouldEqual("test"); book.Reviews.ShouldNotBeNull(); book.Reviews.Single().NumStars.ShouldEqual(1); } }
public async Task TestSoftDeleteServiceSetSoftDeleteViaKeysNotFoundBad() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var status = await service.SetSoftDeleteViaKeysAsync <Book>(123); //VERIFY status.IsValid.ShouldBeFalse(); status.GetAllErrors().ShouldEqual("Could not find the entry you ask for."); status.Result.ShouldEqual(0); } }
public async Task TestAddBookWithReviewOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); //ATTEMPT context.AddBookWithReviewToDb(); } using (var context = new SingleSoftDelDbContext(options)) { //VERIFY var book = await context.Books.Include(x => x.Reviews).SingleAsync(); book.Title.ShouldEqual("test"); book.Reviews.ShouldNotBeNull(); book.Reviews.Single().NumStars.ShouldEqual(1); } }
public async Task TestSoftDeleteServiceSetSoftDeleteViaKeysNotFoundReturnsZero() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var config = new ConfigSoftDeleteWithUserId(context) { NotFoundIsNotAnError = true }; var service = new SingleSoftDeleteServiceAsync <ISingleSoftDelete>(config); //ATTEMPT var status = await service.SetSoftDeleteViaKeysAsync <Book>(123); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(0); } }
public void TestHardDeleteViaKeysNotFoundOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options)) { context.Database.EnsureCreated(); var book = context.AddBookWithReviewToDb(); var config = new ConfigSoftDeleteWithUserId(context); var service = new SingleSoftDeleteService <ISingleSoftDelete>(context, config); var status1 = service.SetSoftDelete(book); status1.IsValid.ShouldBeTrue(status1.GetAllErrors()); //ATTEMPT var status = service.HardDeleteViaKeys <Book>(234); //VERIFY status.IsValid.ShouldBeFalse(status.GetAllErrors()); status.GetAllErrors().ShouldEqual("Could not find the entry you ask for."); } }
public void TestExpressionBuilderFormOtherFiltersOnlyWithUserIdOk() { //SETUP var currentUser = Guid.NewGuid(); var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using (var context = new SingleSoftDelDbContext(options, currentUser)) { context.Database.EnsureCreated(); var order1 = new Order { OrderRef = "Cur user Order, soft del", SoftDeleted = true, UserId = currentUser }; var order2 = new Order { OrderRef = "Cur user Order", SoftDeleted = false, UserId = currentUser }; var order3 = new Order { OrderRef = "Diff user Order", SoftDeleted = true, UserId = Guid.NewGuid() }; context.AddRange(order1, order2, order3); context.SaveChanges(); var config = new ConfigSoftDeleteWithUserId(context); //ATTEMPT var query = context.Orders.IgnoreQueryFilters().Where( config.FilterToGetValueSingleSoftDeletedEntities <Order, ISingleSoftDelete>()) .Select(x => x.OrderRef); var result = query.ToList(); //VERIFY _output.WriteLine(query.ToQueryString()); result.Count.ShouldEqual(1); } }
public void TestResetSoftDeleteOk() { //SETUP var options = SqliteInMemory.CreateOptions <SingleSoftDelDbContext>(); using var context = new SingleSoftDelDbContext(options); context.Database.EnsureCreated(); var shadowClass = new ShadowDelClass(); context.Add(shadowClass); context.Entry(shadowClass).Property("SoftDeleted").CurrentValue = true; context.SaveChanges(); var config = new ConfigSoftDeleteShadowDel(context); var service = new SingleSoftDeleteService <IShadowSoftDelete>(config); //ATTEMPT var status = service.ResetSoftDelete(shadowClass); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1); context.ShadowDelClasses.Count().ShouldEqual(1); }