public ControllerFixture() { var builder = new ConfigurationBuilder() .SetBasePath(GetFullPathToTestConfigFile()) .AddJsonFile(configFileName, optional: false, reloadOnChange: true); Configuration = builder.Build(); var optionsBuilder = new DbContextOptionsBuilder <EFCoreSpikeContext>(); optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")); Context = new EFCoreSpikeContext(optionsBuilder.Options); Server = new TestServer(new WebHostBuilder() .ConfigureServices(services => services.AddAutofac()) .UseConfiguration(Configuration) .UseStartup <Startup>()) { BaseAddress = new Uri("https://localhost/") }; var getTokenTask = GetAuthorizationToken(); AuthenticationToken = getTokenTask.Result.AccessToken; }
public static void Initialize(IApplicationBuilder app) { using (var serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { context = serviceScope.ServiceProvider.GetRequiredService <EFCoreSpikeContext>(); context.Database.Migrate(); InitilizeDatabase(); } }
public CourseRepository(EFCoreSpikeContext context) : base(context) { }
public EntityBaseRepository(EFCoreSpikeContext context) { this.context = context; }
public StudentRepository(EFCoreSpikeContext context) : base(context) { }
public BaseRepository(EFCoreSpikeContext context) { Context = context; }