Exemple #1
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
 {
     app.UseCors("CorsPolicy");
     //app.UseHttpsRedirection();
     DbContextExtensions.Seed(app.ApplicationServices.GetService <APSContext>()); //Initial data prepar
     app.UseMvc();
 }
Exemple #2
0
        public static void RegisterMockRepositories(IServiceCollection services)
        {
            var dbContext = services.BuildServiceProvider().GetRequiredService <APSContext>();

            DbContextExtensions.Seed(dbContext); //Initial data preparation


            //Master
            MockLookupRepository = (new GenericRepository <LookupType>(dbContext));
            services.AddSingleton(MockLookupRepository);
            MockMasterRepository = (new Mock <MasterRepository>(MockBehavior.Default, dbContext));
            services.AddSingleton(MockMasterRepository.Object);
            MockLookupValueRepository = (new GenericRepository <LookupValues>(dbContext));
            services.AddSingleton(MockLookupRepository);
            MockMapper        = new Mock <IMapper>();
            MockMasterService = (new Mock <MasterService>(MockBehavior.Strict, MockLookupRepository, MockLookupValueRepository, MockMapper.Object, MockMasterRepository.Object));
            services.AddSingleton(MockMasterService.Object);

            MockIConfiguration = new Mock <IConfiguration>();
            //add more mock repositories below
        }