public Startup(IConfiguration configuration) { Configuration = configuration; //初始化映射关系 MapperInitialize.Initialize(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { /* * services.AddDbContext<ApplicationDbContext>(options => * options.UseSqlServer(Configuration.GetConnectionString("DBConnection"))); */ services.AddDbContext <MerchantPortalDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DBConnection"))); services.AddIdentity <ApplicationUser, ApplicationRole>() .AddEntityFrameworkStores <MerchantPortalDBContext>() .AddDefaultTokenProviders(); /*Model Mapping */ MapperInitialize.ModelMap(); /*------------------ Start Serilog ----------------*/ //services.AddSingleton<Serilog.ILogger>(); services.AddLogging(); /*------------------ End Serilog ---------------- */ // Add application services. services.AddTransient <IEmailSender, EmailSender>(); services.AddTransient <IUnitOfWork, UnitOfWork>(); services.AddMvc(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); MapperInitialize.Configure(); }
public GameServiceTests() { var mapper = MapperInitialize.InitializeAutoMapper().CreateMapper(); var logger = new Mock <ILogger>(); _unitOfWorMock = new Mock <IUnitOfWork>(); _sut = new GameService(_unitOfWorMock.Object, mapper, logger.Object); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <CommentService>().As <ICommentService>(); builder.RegisterType <GameService>().As <IGameService>(); builder.RegisterType <GenreService>().As <IGenreService>(); builder.RegisterType <PlatformTypeService>().As <IPlatformTypeService>(); var mapper = MapperInitialize.InitializeAutoMapper().CreateMapper(); builder.RegisterInstance(mapper); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <ArticleService>().As <IArticleService>(); builder.RegisterType <CommentService>().As <ICommentService>(); builder.RegisterType <QuestionService>().As <IQuestionService>(); builder.RegisterType <UserService>().As <IUserService>(); builder.RegisterType <TagService>().As <ITagService>(); var mapper = MapperInitialize.InitializeAutoMapper().CreateMapper(); builder.RegisterInstance(mapper); }
protected void Application_Start() { JsonConvert.DefaultSettings = () => new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; MapperInitialize.InitializeAutoMapper(); AutofacConfig.ConfigureContainer(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); }
public async Task TestGetTables_WithEmptyFilter() { _applicationContext.Database.EnsureDeleted(); _applicationContext.Matches.AddRange(this.matches); _applicationContext.Tables.AddRange(this.tables); _applicationContext.SaveChanges(); MapperInitialize.Configure(); var filter = new TableFilterDto(); var tables = await _tableService.GetTables(filter); Assert.AreEqual(2, tables.Count); Assert.AreEqual(2, tables[0].Standing.Count); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <EnrolleeService>().As <IEnrolleeService>(); builder.RegisterType <FacultyService>().As <IFacultyService>(); builder.RegisterType <OperatorService>().As <IOperatorService>(); builder.RegisterType <ExaminationSubjectService>().As <IExaminationSubjectService>(); builder.RegisterType <FacultySubjectService>().As <IFacultySubjectService>(); builder.RegisterType <MarkService>().As <IMarkService>(); builder.RegisterType <StatementService>().As <IStatementService>(); builder.RegisterType <SchoolSunjectService>().As <ISchoolSubjectsService>(); builder.RegisterType <AccountService>().As <IAccountService>(); builder.RegisterType <CommentService>().As <ICommentService>(); builder.RegisterType <StudentStatusService>().As <IStudentStatusService>(); builder.RegisterType <MarkService>().As <IMarkService>(); var mapper = MapperInitialize.InitializeAutoMapper().CreateMapper(); builder.RegisterInstance(mapper); }
public ProductCatalogueServiceTests() { MapperInitialize.Initialize(); }
public override void Initialize(KetchupPlatformContainer builder) { MapperInitialize.CreateMappings(); }
public static void Initialize() { MapperInitialize.Configure(); }
public void Initialize() { MapperInitialize.Configure(); options = new DbContextOptionsBuilder <ApplicationContext>() .UseInMemoryDatabase(databaseName: "TestDataBase").Options; _applicationContext = new ApplicationContext(options); _standingService = new StandingService(_applicationContext); _tableService = new TableService(_applicationContext, _standingService); tables = new List <Table> { new Table { Id = 1, LeagueTitle = "Test league", Group = "A", Matchday = 1, Standing = new List <Standing> { new Standing { Id = 1, Team = "Team 1", PlayedGames = 1, Points = 3, Goals = 3, GoalsAgainst = 1, GoalDifference = 2, Win = 1, Lose = 0, Draw = 0 }, new Standing { Id = 2, Team = "Team 2", PlayedGames = 1, Points = 0, Goals = 1, GoalsAgainst = 3, GoalDifference = -2, Win = 0, Lose = 1, Draw = 0 } } }, new Table() { Id = 2, LeagueTitle = "Test league", Group = "B", Matchday = 1, Standing = new List <Standing> { new Standing { Id = 3, Team = "Team 3", PlayedGames = 1, Points = 1, Goals = 1, GoalsAgainst = 1, GoalDifference = 0, Win = 0, Lose = 0, Draw = 1 }, new Standing { Id = 4, Team = "Team 4", PlayedGames = 1, Points = 1, Goals = 1, GoalsAgainst = 1, GoalDifference = 0, Win = 0, Lose = 1, Draw = 1 } } } }; matches = new List <Match>() { new Match { Id = 1, LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 1", AwayTeam = "Team 2", KickoffAt = DateTime.Now, Score = "3:1" }, new Match { Id = 2, LeagueTitle = "Test league", Matchday = 1, Group = "B", HomeTeam = "Team 3", AwayTeam = "Team 4", KickoffAt = DateTime.Now, Score = "1:1" }, }; matchDto = new MatchDto { LeagueTitle = "Test league", Matchday = 1, Group = "B", HomeTeam = "Team 3", AwayTeam = "Team 4", KickoffAt = DateTime.Now.ToString("s"), Score = "1:1" }; matchDto2 = new MatchDto { LeagueTitle = "Test league", Matchday = 1, Group = "B", HomeTeam = "Team 3", AwayTeam = "Team 4", KickoffAt = DateTime.Now.ToString("s"), Score = "1:3" }; }
protected override void Load(ContainerBuilder builder) { base.Load(builder); MapperInitialize.CreateMappings(); builder.RegisterType <AutoMapperObjectMapper>().As <IObjectMapper>().SingleInstance(); }
public HiveServiceTests() { var x = MapperInitialize.Initialize(); }
public void Initilaize() { MapperInitialize.Configure(); options = new DbContextOptionsBuilder <ApplicationContext>() .UseInMemoryDatabase(databaseName: "TestDataBase").Options; _applicationContext = new ApplicationContext(options); _standingService = new StandingService(_applicationContext); _tableService = new TableService(_applicationContext, _standingService); _matchService = new MatchService(_applicationContext, _tableService); matches = new List <Match>() { new Match { Id = 1, LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 1", AwayTeam = "Team 2", KickoffAt = DateTime.Now, Score = "2:1" }, new Match { Id = 2, LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 3", AwayTeam = "Team 4", KickoffAt = DateTime.Now, Score = "1:3" }, new Match { Id = 3, LeagueTitle = "Test league", Matchday = 2, Group = "A", HomeTeam = "Team 2", AwayTeam = "Team 3", KickoffAt = DateTime.Now, Score = "1:6" }, new Match { Id = 4, LeagueTitle = "Test league", Matchday = 2, Group = "A", HomeTeam = "Team 4", AwayTeam = "Team 1", KickoffAt = DateTime.Now.AddDays(-7), Score = "0:1" }, }; matchesDto = new List <MatchDto>() { new MatchDto { LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 1", AwayTeam = "Team 2", KickoffAt = DateTime.Now.ToString("s"), Score = "1:1" }, new MatchDto { LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 3", AwayTeam = "Team 4", KickoffAt = DateTime.Now.ToString("s"), Score = "1:0" }, new MatchDto { LeagueTitle = "Test league", Matchday = 2, Group = "A", HomeTeam = "Team 2", AwayTeam = "Team 3", KickoffAt = DateTime.Now.ToString("s"), Score = "1:3" }, new MatchDto { LeagueTitle = "Test league", Matchday = 2, Group = "A", HomeTeam = "Team 4", AwayTeam = "Team 1", KickoffAt = DateTime.Now.ToString("s"), Score = "2:1" }, }; matchesDto2 = new List <MatchDto>() { new MatchDto { LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 1", AwayTeam = "Team 2", KickoffAt = DateTime.Now.ToString("s"), Score = "2:1" }, new MatchDto { LeagueTitle = "Test league", Matchday = 1, Group = "A", HomeTeam = "Team 3", AwayTeam = "Team 4", KickoffAt = DateTime.Now.ToString("s"), Score = "1:1" }, new MatchDto { LeagueTitle = "Test league", Matchday = 2, Group = "A", HomeTeam = "Team 2", AwayTeam = "Team 3", KickoffAt = DateTime.Now.ToString("s"), Score = "0:1" }, new MatchDto { LeagueTitle = "Test league", Matchday = 2, Group = "A", HomeTeam = "Team 4", AwayTeam = "Team 1", KickoffAt = DateTime.Now.ToString("s"), Score = "2:2" }, }; }
public HiveSectionsManagementServiceTests() { MapperInitialize.Initialize(); }
public ProductCategoryServiceTests() { MapperInitialize.Initialize(); }
public HiveManagementServiceTests() { var x = MapperInitialize.Initialize(); }