public void WithGlobalFilter_SingleFilter_Include() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext(true, enableFilter1: false, includeClass: true)) { Assert.AreEqual(44, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }
public void WithGlobalFilter_ManyFilter_Disable() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext(true, enableFilter1: false, enableFilter2: false, enableFilter3: false, enableFilter4: false)) { Assert.AreEqual(45, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }
public void WithGlobalFilter_WithInstanceFilter_SingleFilter() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext(true, enableFilter1: true)) { ctx.Filter <Inheritance_Interface_Entity>(QueryFilterHelper.Filter.Filter5, entities => entities.Where(x => x.ColumnInt != 5)); Assert.AreEqual(39, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }
public void WithInstanceFilter_SingleFilter_Disable() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext()) { ctx.Filter <Inheritance_Interface_Entity>(QueryFilterHelper.Filter.Filter1, entities => entities.Where(x => x.ColumnInt != 1)); ctx.Filter(QueryFilterHelper.Filter.Filter1).Disable(); Assert.AreEqual(45, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }
public void WithGlobalManagerFilter_ManyFilter_Include() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext()) { QueryFilterHelper.CreateGlobalManagerFilter(true, enableFilter1: false, enableFilter2: false, enableFilter3: false, enableFilter4: false, includeInterface: true, includeBaseClass: true, includeBaseInterface: true); QueryFilterManager.InitilizeGlobalFilter(ctx); Assert.AreEqual(36, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); QueryFilterHelper.ClearGlobalManagerFilter(); } }
public void WithGlobalManagerFilter_SingleFilter_Disable() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext()) { QueryFilterHelper.CreateGlobalManagerFilter(true, enableFilter1: false); QueryFilterManager.InitilizeGlobalFilter(ctx); Assert.AreEqual(45, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); QueryFilterHelper.ClearGlobalManagerFilter(); } }
public void WithInstanceFilter_ManyFilter() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext()) { ctx.Filter <Inheritance_Interface_Entity>(QueryFilterHelper.Filter.Filter1, entities => entities.Where(x => x.ColumnInt != 1)); ctx.Filter <Inheritance_Interface_IEntity>(QueryFilterHelper.Filter.Filter2, entities => entities.Where(x => x.ColumnInt != 2)); ctx.Filter <Inheritance_Interface_Base>(QueryFilterHelper.Filter.Filter3, entities => entities.Where(x => x.ColumnInt != 3)); ctx.Filter <Inheritance_Interface_IBase>(QueryFilterHelper.Filter.Filter4, entities => entities.Where(x => x.ColumnInt != 4)); Assert.AreEqual(35, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }
public void WithGlobalFilter_WithInstanceFilter_ManyFilte_Disable() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext(true, enableFilter1: false, enableFilter2: false, enableFilter3: false, enableFilter4: false)) { ctx.Filter <Inheritance_Interface_Entity>(QueryFilterHelper.Filter.Filter5, entities => entities.Where(x => x.ColumnInt != 5)); ctx.Filter <Inheritance_Interface_IEntity>(QueryFilterHelper.Filter.Filter6, entities => entities.Where(x => x.ColumnInt != 6)); ctx.Filter <Inheritance_Interface_Base>(QueryFilterHelper.Filter.Filter7, entities => entities.Where(x => x.ColumnInt != 7)); ctx.Filter <Inheritance_Interface_IBase>(QueryFilterHelper.Filter.Filter8, entities => entities.Where(x => x.ColumnInt != 8)); ctx.Filter(QueryFilterHelper.Filter.Filter5).Disable(); ctx.Filter(QueryFilterHelper.Filter.Filter6).Disable(); ctx.Filter(QueryFilterHelper.Filter.Filter7).Disable(); ctx.Filter(QueryFilterHelper.Filter.Filter8).Disable(); Assert.AreEqual(45, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }
public void WithInstanceFilter_ManyFilter_Exclude() { TestContext.DeleteAll(x => x.Inheritance_Interface_Entities); TestContext.Insert(x => x.Inheritance_Interface_Entities, 10); using (var ctx = new TestContext()) { ctx.Filter <Inheritance_Interface_Entity>(QueryFilterHelper.Filter.Filter1, entities => entities.Where(x => x.ColumnInt != 1), false); ctx.Filter <Inheritance_Interface_IEntity>(QueryFilterHelper.Filter.Filter2, entities => entities.Where(x => x.ColumnInt != 2), false); ctx.Filter <Inheritance_Interface_Base>(QueryFilterHelper.Filter.Filter3, entities => entities.Where(x => x.ColumnInt != 3), false); ctx.Filter <Inheritance_Interface_IBase>(QueryFilterHelper.Filter.Filter4, entities => entities.Where(x => x.ColumnInt != 4), false); ctx.Filter(QueryFilterHelper.Filter.Filter1).Enable(); ctx.Filter(QueryFilterHelper.Filter.Filter2).Enable(); ctx.Filter(QueryFilterHelper.Filter.Filter3).Enable(); ctx.Filter(QueryFilterHelper.Filter.Filter4).Enable(); ctx.Filter(QueryFilterHelper.Filter.Filter2).Disable(typeof(Inheritance_Interface_IEntity)); ctx.Filter(QueryFilterHelper.Filter.Filter3).Disable(typeof(Inheritance_Interface_Base)); ctx.Filter(QueryFilterHelper.Filter.Filter4).Disable(typeof(Inheritance_Interface_IBase)); Assert.AreEqual(44, ctx.SetFiltered <Inheritance_Interface_Entity>().Sum(x => x.ColumnInt)); } }