public CrudTests(ITestOutputHelper output) { var context = new DummyDataDBInitializer().CreateContextForInMemory(); DummyDataDBInitializer db = new DummyDataDBInitializer(); db.Seed(context); _repo = new Repository <BaseEntity>(context); _logger = new XunitLogger <TestController>(output); }
// Once we have available the instance of the "TALTestDBContext". // Then we will go to get the instance of the actual repository "OccupationRepository" based on the instance of "TALTestDBContext" // as follows inside the "OccupationControllerShould" constructor static OccupationControllerShould() { dbContextOptions = new DbContextOptionsBuilder <TALTestDBContext>() .UseSqlServer(connectionString) .Options; var context = new BlogDBContext(dbContextOptions); DummyDataDBInitializer db = new DummyDataDBInitializer(); db.Seed(context); repository = new OccupationRepository(context); }