// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_3_0); // Register the Swagger generator, defining 1 or more Swagger documents SwaggerConfig.Register(services); //For Getting current Context HttpServiceCollectionExtensions.AddHttpContextAccessor(services); //Register Identity IdentityConfig.RegisterAppDatabase(services, Configuration); IdentityConfig.Register(services, Configuration); //Dependancy registraion RegisterDependancyConfig.Register(services); services.AddControllers(); }
public void AddHttpContextAccessor_ThrowsWithoutServices() { Assert.Throws <ArgumentNullException>("services", () => HttpServiceCollectionExtensions.AddHttpContextAccessor(null)); }