private static ThreadService GetThreadService(OnlineForumContext context) { var mapper = GetMapper(); var threadService = new ThreadService(context, mapper); return(threadService); }
protected static OnlineForumContext GetNewContext() { var options = GetOptions(); var context = new OnlineForumContext(options); return(context); }
private static UserService GetUserService(OnlineForumContext context) { var mapper = GetMapper(); var userService = new UserService(context, mapper); return(userService); }
private static CommentService GetCommentService(OnlineForumContext context) { var mapper = GetMapper(); var commentService = new CommentService(context, mapper); return(commentService); }
public void InitialiseData() { var options = new DbContextOptionsBuilder <OnlineForumContext>() .UseInMemoryDatabase(databaseName: "ServiceTestsDatabase") .Options; var context = new OnlineForumContext(options); using (context) { DbInitializer.InitializeTestData(context); } }
public CommentService(OnlineForumContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public ThreadService(OnlineForumContext context, IMapper mapper) { _context = context; _mapper = mapper; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, OnlineForumContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCookieAuthentication(new CookieAuthenticationOptions() { AuthenticationScheme = "CookieAuthentication", LoginPath = new PathString("/Account/Login"), AccessDeniedPath = new PathString("/Account/Forbidden/"), AutomaticAuthenticate = true, AutomaticChallenge = true }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "Users", template: "Users/{userId}", defaults: new { controller = "Users", action = "User" }); routes.MapRoute( name: "default", template: "{controller=Forum}/{action=Index}/{id?}"); }); DbInitializer.Initialize(context); }