using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol; using Xunit.Sdk; namespace PoweredSoft.DynamicQuery.Test.Mock { public static class MockContextFactory { public static void TestContextFor(string testName, Action action) { var options = new DbContextOptionsBuilder() .UseInMemoryDatabase(databaseName: testName).Options; using var ctx = new MockContext(options); action(ctx); } public static void SeedAndTestContextFor(string testName, Action seedAction, Action action) { seedAction(testName); TestContextFor(testName, action); } } }