public IEnumerable <IQuery <NullDbContext> > CreateNullDbContextObjectQueries(NullDbContext dbContext) => new List <IQuery <NullDbContext> >() { new QueryTypeNullDbContextOne(dbContext, TestObjectViewer.DisplayData), new QueryTypeNullDbContextTwo(dbContext, TestObjectViewer.DisplayData), new QueryTypeNullDbContextThree(dbContext, TestObjectViewer.DisplayData) };
internal static void Main() { // Using an EF Core provider using var dbContext = new EfCoreContext(); var totalQueries = new QueryologyEngineBuilder <EfCoreContext>() .Configure(options => options.DataContextProvider = dbContext) .AddObjectDumper() .Build() .Execute(); Console.WriteLine($"\n🦄🦄 Total Queries allowed to be executed by QueryologyEngine<EfCoreContext>: {totalQueries}"); Console.WriteLine("🐵🐵 Press Enter to continue... 🐵🐵"); Console.ReadLine(); // Only to work with LINQ to Objects using var nullDbContext = new NullDbContext(); totalQueries = new QueryologyEngineBuilder <NullDbContext>() .Configure(options => options.DataContextProvider = nullDbContext) .AddObjectDumper() .Build() .Execute(); Console.WriteLine($"\n🦄🦄 Total Queries allowed to be executed by QueryologyEngine<NullDbContext>: {totalQueries}"); Console.WriteLine("🐵🐵 Press Enter to continue... 🐵🐵"); Console.ReadLine(); }
public void IgnoreExcludedQueries_NoFiltersQueries_WhenIsSetToFalse() { // Arrange using var dbContext = new NullDbContext(); var queries = _testBuilderFactory.CreateNullDbContextObjectQueries(dbContext); // Act var result = queries.IgnoreExcludedQueries(false).Count(); // Assert Assert.Equal(3, result); }
public void Initalize() { IServiceCollection services = new ServiceCollection(); services.AddDbContext <MockDbContext>( options => options.UseInMemoryDatabase("TestsInMemoryDb-" + Guid.NewGuid().ToString()) .EnableSensitiveDataLogging() ); services.AddDbContext <NullDbContext>( options => options.UseInMemoryDatabase("NullTestsInMemoryDb-" + Guid.NewGuid().ToString()) .EnableSensitiveDataLogging() ); ServiceProvider serviceProvider = services.BuildServiceProvider(); _context = serviceProvider.GetService <MockDbContext>(); _nullContext = serviceProvider.GetService <NullDbContext>(); }