public void DeactivateById() { try { var options = CreateNewContextOptions(); using (var db = new AuctionContext(options)) { AuctionTestHelper.PopulateDefaultData(db); } using (var db = new AuctionContext(options)) { var repository = new AuctionRepository(db); var item = GenerateModel(); item.IsActive = true; Assert.DoesNotThrow(() => repository.Save(item)); Assert.DoesNotThrow(() => item = repository.Deactivate(item.Id)); Assert.DoesNotThrow(() => repository.Delete(item)); Assert.IsFalse(item.IsActive); } } catch (Exception ex) { LogEventManager.Logger.Error(ex); throw; } }