public void ExpectAddMarkToReturnBadRequestWhenModelStateIsInvalid()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(CoursesController).Assembly);
            const string ResultContent = "Bad Request";

            var courseServiceMock = new Mock<ICoursesService>();
            var contextMock = new Mock<HttpContextBase>();

            var routeData = new RouteData();
            routeData.Values.Add("id", 6);

            contextMock.SetupGet(x => x.Request.RequestContext)
                .Returns(new RequestContext(contextMock.Object, routeData));

            courseServiceMock.Setup(x =>
                x.AddMark(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>()));

            var controller = new CoursesController(null, courseServiceMock.Object);

            //// Set ModelState to false
            controller.ModelState.AddModelError("Property", "Cannot be null");
            controller.ControllerContext = new ControllerContext(contextMock.Object, routeData, controller);
            var result = controller
                .WithCallTo(x => x.AddMark(null, 2, new MarkInputModel() { }))
                .ShouldGiveHttpStatus(HttpStatusCode.BadRequest);

            Assert.AreEqual(ResultContent, result.StatusDescription);
        }
        public void Init()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(OrganizationsController).Assembly);

            var organizations = new Mock<IOrganizationsService>();
            organizations.Setup(x => x.Edit(It.IsAny<int>(), It.IsAny<string>()))
                .Returns(new Organization
                {
                    Id = 42
                });

            organizations.Setup(x => x.GetAll())
                .Returns(new List<Organization> {
                       new Organization {
                            Id = 42
                        }
                    }.AsQueryable());

            organizations.Setup(x => x.GetAllWithDeleted())
                .Returns(new List<Organization> {
                       new Organization {
                            Id = 42
                        }
                    }.AsQueryable());

            this.controller = new OrganizationsController(organizations.Object);
        }
        public void Init()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(UsersController).Assembly);

            var users = new Mock<IUsersService>();
            users.Setup(x => x.Edit(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()));

            users.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User
                {
                    Id = "userId"
                });

            users.Setup(x => x.GetAll())
                .Returns(new List<User> {
                       new User {
                            Id = "userId"
                        }
                    }.AsQueryable());

            users.Setup(x => x.GetUsersUserNames(It.IsAny<string>()))
                .Returns(new List<string>
                {
                    "username1",
                    "username2"
                }.AsQueryable());

            this.controller = new UsersController(users.Object);
        }
Exemplo n.º 4
0
        public void Configuration(IAppBuilder app)
        {
            this.ConfigureAuth(app);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute();
        }
        public void PlanetAreaControllerTestsSetup()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(CommentsController).Assembly);

            var commentsServiceMock = new Mock<ICommentsService>();
            commentsServiceMock
                .Setup(x => x.GetPagesCount(tutorialId))
                .Returns(pages);

            commentsServiceMock
                .Setup(x => x.GetByPage(tutorialId, page))
                .Returns(new List<Comment>()
                {
                    new Comment
                    {
                        Content = content,
                        Tutorial = new Tutorial { Title = "" },
                        Author = new User()
                    },
                    new Comment
                    {
                        Content = content,
                        Tutorial = new Tutorial { Title = "" },                      
                        Author = new User()
                    }
                }.AsQueryable());

            commentsController = new CommentsController(commentsServiceMock.Object);
        }
Exemplo n.º 6
0
        protected override void OnSetup()
        {
            base.OnSetup();

            var infrastructureAutoMapperConfig = new Infrastructure.Web.Mapping.AutoMapperConfig ();
            infrastructureAutoMapperConfig.Execute ();

            var agencyAutoMapperConfig = new AutoMapperConfig ();
            agencyAutoMapperConfig.Execute ();
        }
 protected void Application_Start()
 {
     ViewEngineConfig.RegisterViewEngines(ViewEngines.Engines);
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     var autoMapperConfig = new AutoMapperConfig(new[] {Assembly.GetExecutingAssembly() });
     autoMapperConfig.Execute();
 }
        public void InitializeController()
        {
            this.automapperConfig = new AutoMapperConfig();
            this.automapperConfig.Execute(typeof(HomeController).Assembly);

            this.packages = Services.GetPackagesService();
            this.issues = Services.GetIssuesService();
            this.users = Services.GetUsersService();

            this.controller = new HomeController(this.packages, this.issues, this.users);
        }
        public void CleanUpController()
        {
            this.automapperConfig = null;

            this.packages = null;
            this.issues = null;
            this.users = null;

            this.controller.Dispose();
            this.controller = null;
        }
Exemplo n.º 10
0
        protected void Application_Start()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<ApplicationDbContext, Configuration>());
            AutofacConfig.RegisterAutofac();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
Exemplo n.º 11
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ViewEnginesConfig.RegisterEngines();
            DbConfig.Initialize();

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
Exemplo n.º 12
0
        protected void Application_Start()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<SnippyDbContext, SnippyDbConfiguration>());

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ViewEnginesConfig.RegisterViewEngines(ViewEngines.Engines);

            var autoMapperConfig = new AutoMapperConfig(new List<Assembly> { Assembly.GetExecutingAssembly() });
            autoMapperConfig.Execute();
        }
Exemplo n.º 13
0
        protected void Application_Start()
        {
            ViewEnginesConfig.RegisterViewEngines();
            IdentifyConfig.RegisterIdentifiers(this.Context);
            AreaRegistration.RegisterAllAreas();
            DatabaseConfig.Initialize();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());

            DbConfig.Initialize();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.Load("AncientCivilizations.Web.Models"));
        }
        public void PlanetAreaControllerTestsSetup()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(TutorialsController).Assembly);

            var tutorialsServiceMock = new Mock<ITutorialsService>();
            tutorialsServiceMock
                .Setup(x => x.Add(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), null))
                .Returns(id);

            var likesServiceMock = new Mock<ILikesService>();

            tutorialsController = new TutorialsController(tutorialsServiceMock.Object, likesServiceMock.Object);
        }
Exemplo n.º 16
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());

            var autoMapperConfig = new AutoMapperConfig(new List<Assembly> {Assembly.GetExecutingAssembly()});
            autoMapperConfig.Execute();

            ModelBinderProviders.BinderProviders.Add(new EntityModelBinderProviderById());
        }
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());

            Database.SetInitializer(new MigrateDatabaseToLatestVersion<EmployerEmployeeHuntDbContext, Configuration>());
            AutofacConfig.RegisterAutofac();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
Exemplo n.º 18
0
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());

            DatabaseConfig.Initialize();
            AutofacConfig.RegisterAutofac();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
        public void ByIdShouldWorkCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(RealEstatesController).Assembly);
            const string RealEstateTitle = "SomeTitle";
            var realEstateServiceMock = new Mock<IRealEstatesService>();

            realEstateServiceMock.Setup(x => x.GetByEncodedId(It.IsAny<string>()))
                .Returns(new RealEstate
                {
                    Title = RealEstateTitle,
                    Description = "asghftrjryjrgyhy",
                    Address = "asrhstgyhuhsry"
                });
        }
        public void Init()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(DevelopersController).Assembly);

            var developers = new Mock<IDeveloperProfilesService>();
            developers.Setup(d => d.GetAll())
                .Returns(new List<DeveloperProfile>
                {
                    new DeveloperProfile
                    {
                        Id = "userId"
                    }
                }.AsQueryable());

            this.controller = new DevelopersController(developers.Object);
        }
 public void ByIdShouldWorkCorrectly()
 {
     var autoMapperConfig = new AutoMapperConfig();
     autoMapperConfig.Execute(typeof(JokesController).Assembly);
     const string JokeContent = "SomeContent";
     var jokesServiceMock = new Mock<IJokesService>();
     jokesServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
         .Returns(new Joke { Content = JokeContent, Category = new JokeCategory { Name = "asda" } });
     var controller = new JokesController(jokesServiceMock.Object);
     controller.WithCallTo(x => x.ById("asdasasd"))
         .ShouldRenderView("ById")
         .WithModel<JokeViewModel>(
             viewModel =>
                 {
                     Assert.AreEqual(JokeContent, viewModel.Content);
                 }).AndNoModelErrors();
 }
Exemplo n.º 22
0
        public void SetUp()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(HomeController).Assembly);
            var surveysServiceMock = new Mock<ISurveyService>();
            var userServiceMock = new Mock<IUserService>();

            userServiceMock
                .Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { Email = UserEmail, UserName = UserName, PasswordHash = "123" });

            surveysServiceMock
                .Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new Survey { Id = 1, Title = SurveyTitle, Author = userServiceMock.Object.GetById("dsds"), AuthorId = userServiceMock.Object.GetById("dsss").Id, IsPublic = true });

            this.controller = new HomeController(userServiceMock.Object, surveysServiceMock.Object);
        }
        public void ShouldWorkWithCorrectId()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(DetailsController).Assembly);

            var hotelServiceMock = new Mock<IHotelsService>();
            hotelServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(HotelForTest);

            var hotelRoomsServiceMock = new Mock<IHotelRoomsService>();

            var controller = new DetailsController(hotelServiceMock.Object, hotelRoomsServiceMock.Object);
            controller.WithCallTo(x => x.HotelDetails(1))
                .ShouldRenderView("HotelDetails")
                .WithModel<DetailsViewModel>(
                viewModel =>
                {
                    Assert.AreEqual(HotelForTest, viewModel.Hotel);
                }).AndModelError("");
        }
        public void Init()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(SkillsController).Assembly);

            var skills = new Mock<ISkillsService>();
            skills.Setup(x => x.Edit(It.IsAny<int>(), It.IsAny<string>()))
                .Returns(new Skill
                {
                    Id = 42
                });

            skills.Setup(x => x.GetAll())
                .Returns(new List<Skill> {
                       new Skill {
                            Id = 42
                        }
                    }.AsQueryable());

            this.controller = new SkillsController(skills.Object);
        }
Exemplo n.º 25
0
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorEngineExtension());

            Database.SetInitializer(new MigrateDatabaseToLatestVersion<ApplicationDbContext, Configuration>());

            AutofacConfig.RegisterAutofac();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var config = new HttpConfiguration();

            JsonNetConfig.UseCamelCase(config);
            WebApiConfig.Register(config);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
        protected void Application_Start()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<AppDbContext, Configuration>());

<<<<<<< HEAD
            //using (var db = new AppDbContext())
            //{
            //    db.Database.Initialize(true);
            //}

=======
>>>>>>> 6ca5c2744ff07e9ad93c0f5627d37f5deea149bf
            AutofacConfig.RegisterAutofac();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());
        }
Exemplo n.º 27
0
        public void SetUp()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(SurveysController).Assembly);
            var surveysServiceMock = new Mock<ISurveyService>();
            var userServiceMock = new Mock<IUserService>();
            var questionServiceMock = new Mock<IQuestionService>();
            var responseServiceMock = new Mock<IResponseService>();

            userServiceMock
                .Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { Email = UserEmail, UserName = UserName, PasswordHash = "123" });

            surveysServiceMock
                .Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new Survey { Id = 1, Title = SurveyTitle, Author = userServiceMock.Object.GetById("dsds"), AuthorId = userServiceMock.Object.GetById("dsss").Id, IsPublic = true, Questions = new List<Question> { new Question { } } });

            questionServiceMock.Setup(x => x.GetNext(It.IsAny<Question>(), It.IsAny<string>())).Returns(new Question { Content = string.Empty });
            responseServiceMock.Setup(x => x.Update(It.IsAny<Response>())).Returns(new Response { });

            this.controller = new SurveysController(surveysServiceMock.Object, userServiceMock.Object, questionServiceMock.Object, responseServiceMock.Object);
        }
Exemplo n.º 28
0
        protected void Application_Start()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
            DatabaseConfig.Config();
            AutofacConfig.RegisterAutofac();

            ModelBinders.Binders.Add(typeof(double), new DoubleModelBinder());
            ModelBinders.Binders.Add(typeof(double?), new NullableDoubleModelBinder());

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(Assembly.GetExecutingAssembly());

        }
        private ProductsController SetupController()
        {
            //const string ProductDescription = "SomeDescr";
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(ProductsController).Assembly);
            var productsServiceMock = new Mock<IProductsService>();
            productsServiceMock
                .Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new Product()
                {
                    Title = "someName",
                    ShortDescription = this.ProductDescription,
                    Category = new Category()
                    {
                        Name = "someName"
                    }
                });

            var cacheServiceMock = new Mock<ICacheService>();
            var controller = new ProductsController(productsServiceMock.Object, cacheServiceMock.Object);

            return controller;
        }
        public void PlanetAreaControllerTestsSetup()
        {
            var automapperConfig = new AutoMapperConfig();
            automapperConfig.Execute(typeof(ReviewsController).Assembly);

            var reviewsServiceMock = new Mock<IReviewsService>();
            reviewsServiceMock
                .Setup(x => x.GetById(reviewId))
                .Returns(new Review()
                {
                    Content = reviewContent,
                    Category = new Category() { Name = "Some" }
                });

            reviewsServiceMock
                .Setup(x => x.GetByPageAndCategory(category, page))
                .Returns(new List<Review>()
                {
                    new Review
                    {
                        Content = reviewContent,
                        Category = new Category() { Name = "Some" },
                        GameTitle = gameTitle
                    },
                    new Review
                    {
                        Content = reviewContent,
                        Category = new Category() { Name = "Some" },
                        GameTitle = gameTitle
                    }
                }.AsQueryable());

            var categoriesServiceMock = new Mock<ICategoriesService>();
            
            reviewsController = new ReviewsController(reviewsServiceMock.Object, categoriesServiceMock.Object);
        }
Exemplo n.º 31
0
 protected override void Load(ContainerBuilder builder)
 {
     builder.Register(cnt => AutoMapperConfig.GetConfiguration()).SingleInstance();
     builder.Register(cnt => cnt.Resolve <MapperConfiguration>().CreateMapper()).SingleInstance();
 }
Exemplo n.º 32
0
 public static void Init(TestContext test)
 {
     AutoMapperConfig.RegisterMappings(Assemblies.WebApi);
 }
Exemplo n.º 33
0
 public static void AddAutoMapperSetup(this IServiceCollection services, IConfiguration configuration)
 {
     services.AddAutoMapper();
     AutoMapperConfig.RegisterMappings();
 }
Exemplo n.º 34
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     AutoMapperConfig.Initialize();
 }
Exemplo n.º 35
0
 public CategoryServiceTests()
 {
     AutoMapperConfig.RegisterMappings(
         typeof(Category).GetTypeInfo().Assembly,
         typeof(CategoryViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 36
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();
            services.AddDbContext <DataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
            services.AddDbContext <HPDataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("HPConnection")));
            services.AddDbContext <UserContext>(options => options.UseSqlServer(Configuration.GetConnectionString("UserConnection")));
            services.AddControllers();
            //Auto Mapper
            services.AddAutoMapper(typeof(Startup));
            services.AddScoped <IMapper>(sp =>
            {
                return(new Mapper(AutoMapperConfig.RegisterMappings()));
            });
            services.AddSingleton(AutoMapperConfig.RegisterMappings());
            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options =>
            {
                options.RequireHttpsMetadata      = false;
                options.SaveToken                 = true;
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(Encoding.ASCII
                                                                        .GetBytes(Configuration.GetSection("AppSettings:Token").Value)),
                    ValidateIssuer   = false,
                    ValidateAudience = false
                };
            });
            // Repository
            services.AddScoped <IPackingListRepository, PackingListRepository>();
            services.AddScoped <ICodeIDDetailRepo, CodeIDDetailRepo>();
            services.AddScoped <IRackLocationRepo, RackLocationRepo>();
            services.AddScoped <IQRCodeMainRepository, QRCodeMainRepository>();
            services.AddScoped <IPackingListDetailRepository, PackingListDetailRepository>();
            services.AddScoped <IQRCodeDetailRepository, QRCodeDetailRepository>();
            services.AddScoped <IHPMaterialRepository, HPMaterialRepository>();
            services.AddScoped <IHPStyleRepository, HPStyleRepository>();
            services.AddScoped <IHPVendorRepository, HPVendorRepository>();
            services.AddScoped <IMaterialPurchaseRepository, MaterialPurchaseRepository>();
            services.AddScoped <IMaterialMissingRepository, MaterialMissingRepository>();
            services.AddScoped <IMaterialViewRepository, MaterialViewRepository>();
            services.AddScoped <ITransactionMainRepo, TransactionMainRepo>();
            services.AddScoped <ITransactionDetailRepo, TransactionDetailRepo>();
            services.AddScoped <IMaterialSheetSizeRepository, MaterialSheetSizeRepository>();
            services.AddScoped <IUsersRepository, UsersRepository>();
            services.AddScoped <IRolesRepository, RolesRepository>();
            services.AddScoped <IRoleUserRepository, RoleUserRepository>();

            // Service
            services.AddScoped <IPackingListService, PackingListService>();
            services.AddScoped <ICodeIDDetailService, CodeIDDetailService>();
            services.AddScoped <IRackLocationService, RackLocationService>();
            services.AddScoped <IQRCodeMainService, QRCodeMainService>();
            services.AddScoped <IPackingListDetailService, PackingListDetailService>();
            services.AddScoped <IQRCodeDetailService, QRCodeDetailService>();
            services.AddScoped <IHPMaterialService, HPMaterialService>();
            services.AddScoped <IHPStyleService, HPStyleService>();
            services.AddScoped <IHPVendorService, HPVendorService>();
            services.AddScoped <IReceivingService, ReceivingService>();
            services.AddScoped <IInputService, InputService>();
            services.AddScoped <ITransferLocationService, TransferLocationService>();
            services.AddScoped <IOutputService, OutputService>();
            services.AddScoped <IAuthService, AuthService>();
        }
 /// <summary>
 /// Initializes a new instance of ReservatonController class.
 /// </summary>
 public ReservationController()
 {
     _reservationService = new ReservationService(AutoMapperConfig.Initialize());
     _customerService    = new CustomerService(AutoMapperConfig.Initialize());
 }
Exemplo n.º 38
0
 public static void InitializeMapper()
 {
     AutoMapperConfig.RegisterMappings(
         typeof(TopicsService).GetTypeInfo().Assembly,
         typeof(TopicDetailsViewModel).GetTypeInfo().Assembly);
 }
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .Configure <CookiePolicyOptions>(options =>
            {
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services
            .AddDbContext <OnlineLibraryManagementSystemDbContext>(options => options
                                                                   .UseSqlServer(this.Configuration.GetConnectionString("DefaultConnection")));

            services
            .AddIdentity <User, IdentityRole>(options =>
            {
                options.Password.RequireDigit           = false;
                options.Password.RequireLowercase       = false;
                options.Password.RequireUppercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.User.RequireUniqueEmail         = true;
                options.SignIn.RequireConfirmedEmail    = true;
            })
            .AddDefaultUI(UIFramework.Bootstrap4)
            .AddEntityFrameworkStores <OnlineLibraryManagementSystemDbContext>()
            .AddDefaultTokenProviders();

            services
            .AddAuthentication()
            .AddFacebook(facebookOptions =>
            {
                facebookOptions.AppId     = this.Configuration["Authentication:Facebook:AppId"];
                facebookOptions.AppSecret = this.Configuration["Authentication:Facebook:AppSecret"];
            })
            .AddGoogle(googleOptions =>
            {
                googleOptions.ClientId     = this.Configuration["Authentication:Google:ClientId"];
                googleOptions.ClientSecret = this.Configuration["Authentication:Google:ClientSecret"];
            })
            .AddMicrosoftAccount(microsoftOptions =>
            {
                microsoftOptions.ClientId     = this.Configuration["Authentication:Microsoft:ApplicationId"];
                microsoftOptions.ClientSecret = this.Configuration["Authentication:Microsoft:Password"];
            });

            services.AddResponseCompression();

            services.AddRouting(options => options.LowercaseUrls = true);

            services.AddDomainServices();

            services.AddAutoMapper();

            AutoMapperConfig.RegisterMappings(typeof(AuthorServiceModel).Assembly);

            services.AddOptions();
            services.Configure <EmailSettings>(this.Configuration.GetSection("EmailSettings"));

            services.AddMvc(options =>
            {
                options.Filters.Add <AutoValidateAntiforgeryTokenAttribute>();
            });

            services
            .AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
Exemplo n.º 40
0
 public AwardsServiceTest()
 {
     AutoMapperConfig.RegisterMappings(typeof(AwardTestModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 41
0
 public static void InitializeMapper()
 {
     AutoMapperConfig.RegisterMappings(
         typeof(CommentEditModel).GetTypeInfo().Assembly,
         typeof(CategoryViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 42
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AutoMapperConfig.RegisterMappings();
 }
Exemplo n.º 43
0
        private void InitializeMapping()
        {
            const string MAPPING_ASSEMBLY = "SportsBetting.Handlers.Commands";

            AutoMapperConfig.RegisterMappings(Assembly.Load(MAPPING_ASSEMBLY));
        }
 public ServiceRepository(IUserRepository userRepository)
 {
     _userrepository = userRepository;
     AutoMapperConfig.init();
     mapper = AutoMapperConfig.Mapper;
 }
Exemplo n.º 45
0
 private void InitializeMapper() => AutoMapperConfig.
 RegisterMappings(Assembly.Load("CinemaWorld.Models.ViewModels"));
Exemplo n.º 46
0
 public static IServiceCollection AddAutoMapper(this IServiceCollection services)
 {
     return(services.AddSingleton(AutoMapperConfig.MapperConfig()));
 }
Exemplo n.º 47
0
 public PhotoServiceTests()
 {
     AutoMapperConfig.RegisterMappings(typeof(PhotoViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 48
0
 protected void Application_Start()
 {
     AutoMapperConfig.Configure();
     UnityConfig.RegisterComponents();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Exemplo n.º 49
0
 private void InitializeMapper() => AutoMapperConfig.
     RegisterMappings(Assembly.Load("LotusCatering.Web.ViewModels"));
Exemplo n.º 50
0
        // 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_2_2).AddJsonOptions(opts =>
            {
                var resolver = opts.SerializerSettings.ContractResolver;
                if (resolver != null)
                {
                    (resolver as DefaultContractResolver).NamingStrategy = null;
                }
            });
            ///servicessss
            services.AddTransient <IRequestService, RequestService>();
            services.AddTransient <IPayslipService, PayslipService>();
            services.AddTransient <IViewRenderService, ViewRenderService>();
            services.AddTransient <IEmployeeService, EmployeeService>();
            services.AddTransient <IHandlePdfService, HandlePdfService>();
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
            //Reponsitoriesssssssss
            services.AddTransient <IRequestDetailReponsitory, RequestDetailReponsitory>();
            services.AddTransient <IEmployeeReponsitory, EmployeeReponsitory>();
            services.AddTransient <IPayslipDetailReponsitory, PayslipDetailReponsitory>();
            //Db context
            var conectionString = Configuration.GetConnectionString("OSDPayslip");

            //try
            //{
            services.AddDbContext <OSDPayslipDbContext>(opts => opts.UseSqlServer(conectionString));
            //}
            //finally
            //{
            //    using (SqlConnection connection = new SqlConnection(conectionString))
            //    {
            //        try
            //        {
            //            string sql = @"DELETE FROM dbo.RequestDetail WHERE  CreateDate < DATEADD(MONTH, -2, GETDATE())";
            //            using (SqlCommand command = new SqlCommand(sql, connection))
            //            {
            //                command.CommandType = CommandType.Text;
            //                connection.Open();
            //                command.ExecuteNonQuery();
            //                connection.Close();
            //            }
            //        }
            //        finally
            //        {
            //            string sql1 = @"DELETE FROM dbo.PayslipDetails WHERE  CreateDate < DATEADD(MONTH, -2, GETDATE())";
            //            using (SqlCommand command = new SqlCommand(sql1, connection))
            //            {
            //                command.CommandType = CommandType.Text;
            //                connection.Open();
            //                command.ExecuteNonQuery();
            //                connection.Close();
            //            }
            //        }
            //    }
            //}
            // Mapper
            AutoMapperConfig autoMapper = new AutoMapperConfig();
            Mapper           mapper     = autoMapper.RegisterMapping();

            services.AddSingleton(mapper);
            // In production, the React files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/build";
            });
        }
Exemplo n.º 51
0
 public void Initial()
 {
     AutoMapperConfig.Config(Assembly.Load("CarSystem.Web"));
 }
Exemplo n.º 52
0
 public void Setup()
 {
     AutoMapperConfig.CreateMaps();
 }
Exemplo n.º 53
0
 protected override void ConfigureMapping(MapperConfigurationExpression config)
 {
     AutoMapperConfig.Configure(config);
 }
Exemplo n.º 54
0
        protected void Application_Start()
        {
            AutoMapperConfig.Initialize();

            GlobalConfiguration.Configure(WebApiConfig.Register);
        }
Exemplo n.º 55
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            AutoMapperConfig.RegisterMappings(typeof(ErrorViewModel).GetTypeInfo().Assembly);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseMigrationsEndPoint();
            }
            else
            {
                app.UseDeveloperExceptionPage();
                app.UseMigrationsEndPoint();

                //app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            var supportedCultures = new[]
            {
                new CultureInfo("bg-BG"),
            };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("bg-BG"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures
            });

            app.UseWebMarkupMin();
            app.UseResponseCompression();
            app.UseHttpsRedirection();

            app.UseStaticFiles();
            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();
            app.UseSession();

            // Toast notifications
            app.UseNToastNotify();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            // Cache
            app.UseResponseCaching();

            /*app.UseStaticFiles(new StaticFileOptions
             * {
             *  OnPrepareResponse = (context) =>
             *  {
             *      var headers = context.Context.Response.GetTypedHeaders();
             *      headers.CacheControl = new CacheControlHeaderValue
             *      {
             *          Public = true,
             *          MaxAge = TimeSpan.FromDays(365)
             *      };
             *  }
             * });*/

            app.Use(async(context, next) =>
            {
                context.Response.GetTypedHeaders().CacheControl =
                    new CacheControlHeaderValue()
                {
                    Public = true,
                    MaxAge = TimeSpan.FromDays(10)
                };
                context.Response.Headers[HeaderNames.Vary] = new string[] { "Accept-Encoding" };
                await next();
            });
        }
Exemplo n.º 56
0
 public void InitializeAutoMapper()
 {
     AutoMapperConfig.RegisterMappings(typeof(VideoCreate).Assembly);
 }
Exemplo n.º 57
0
 public UsuarioApiController()
 {
     AutoMapperConfig.RegisterMappings();
 }
Exemplo n.º 58
0
 public void Configuration(IAppBuilder app)
 {
     ConfigureAuth(app);
     AutoMapperConfig.Configure();
 }
Exemplo n.º 59
0
 public BaseTest()
 {
     AutoMapperConfig.ConfigMappers();
 }
Exemplo n.º 60
0
 private void InitializeMapper() => AutoMapperConfig.
 RegisterMappings(Assembly.Load("ForumSystem.Web.ViewModels"));