示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });
            var config = new FeedbackConfiguration()
            {
                listOfSteps = new Dictionary <string, string>()
            };

            Configuration.Bind("LightFeedbackSteps", config.listOfSteps);
            services.AddSingleton(config);

            services.AddSingleton <ITempDataProvider, CookieTempDataProvider>();

            services.AddDbContext <AppDbContext>(options =>
                                                 options.UseSqlServer(Configuration.GetConnectionString("AppDbContext")));

            services.AddScoped <IGenericRepository <Customer>, GenericRepository <Customer> >();
            services.AddTransient <ILightFeedbackService, LightFeedbackService>();
            services.AddTransient <ITempDataService, TempDataService>();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }
示例#2
0
 public void Initialize()
 {
     _mockFeedbackConfig     = PopulateFeedbackConfig();
     _mockCustomerRepository = new Mock <IGenericRepository <Customer> >();
 }
示例#3
0
 public LightFeedbackService(IGenericRepository <Customer> customerRepo,
                             FeedbackConfiguration feedbackSteps)
 {
     _customerRepo  = customerRepo ?? throw new ArgumentNullException(nameof(customerRepo));
     _feedbackSteps = feedbackSteps ?? throw new ArgumentNullException(nameof(feedbackSteps));
 }