public void ConfigureServices(IServiceCollection services) { services.AddAutoMapper(typeof(MapperProfile)); services.AddControllers() .AddNewtonsoftJson(option => option.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore ); services.AddSingleton <IConnectionMultiplexer> (c => { var config = ConfigurationOptions.Parse(_configuration.GetConnectionString("Redis"), true); return(ConnectionMultiplexer.Connect(config)); }); ServicesConfiguration.Configure(services); services.AddIdentityService(_configuration); SwaggerServiceExtentions.AddSwaggerDocumentation(services); services.AddCors(options => { options.AddPolicy("CorsPolicy", policy => { policy.AllowAnyHeader() .AllowAnyMethod() .WithOrigins("https://localhost:4200"); }); }); }
static void Main(string[] args) { var serviceProvider = ServicesConfiguration.GetServiceProvider(); SetUpLogger(); new PestoBot(serviceProvider).MainAsync().GetAwaiter().GetResult(); }
public void OneTimeSetup() { var configRootBuilder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddUserSecrets <Startup>(); var configRoot = configRootBuilder.Build(); _databaseConnectionString = configRoot.GetConnectionString("VhVideoApi"); _services = Options.Create(configRoot.GetSection("Services").Get <ServicesConfiguration>()).Value; var dbContextOptionsBuilder = new DbContextOptionsBuilder <VideoApiDbContext>(); dbContextOptionsBuilder.EnableSensitiveDataLogging(); dbContextOptionsBuilder.UseSqlServer(_databaseConnectionString); dbContextOptionsBuilder.EnableSensitiveDataLogging(); VideoBookingsDbContextOptions = dbContextOptionsBuilder.Options; var context = new VideoApiDbContext(VideoBookingsDbContextOptions); context.Database.Migrate(); TestDataManager = new TestDataManager(_services, VideoBookingsDbContextOptions); }
public void Reload() { this.configuration = ServicesConfigurationView.Instance.Configuration; this.trackRunTime = ServicesConfigurationView.Instance.TrackRunTime; // this.nextRunTime = this.configuration.Observers[this.Name].NextRunTime; this.port = Convert.ToInt32(ConfigurationManager.AppSettings["port"]); this.virtualPath = ConfigurationManager.AppSettings["virtualPath"]; if (string.IsNullOrEmpty(this.virtualPath)) { this.virtualPath = "/"; } this.physicalPath = ConfigurationManager.AppSettings["physicalPath"]; if (string.IsNullOrEmpty(this.physicalPath)) { this.physicalPath = KernelConfigurationView.Instance.ApplicationPathRoot; } else { this.physicalPath = System.IO.Path.GetFullPath(this.physicalPath); } }
public static PexipConfigResponse MapPexipConfigToResponse(ServicesConfiguration serviceConfiguration) { return(new PexipConfigResponse { PexipSelfTestNode = serviceConfiguration.PexipSelfTestNode }); }
public void ConfigureServices(IServiceCollection services) { services.AddAuth(Configuration); services.AddDataAccess(Configuration); services.AddApplication(); services.AddScoped <ICurrentUserService, CurrentUserService>(); services .AddControllers() .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <IAppDbContext>()); services.AddCors(o => o.AddPolicy("AllowOrigin", builder => { builder .WithOrigins("http://localhost:5000") .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); SpaConfiguration.RegisterStaticFiles(services, Configuration); OptionsConfiguration.RegisterOptions(services, Configuration); JwTAuthenticationConfiguration.RegisterJwtAuthentication(services, Configuration); ServicesConfiguration.RegisterServices(services); }
public UsuarioRepositorioTeste() { var configServices = ServicesConfiguration.Configure(); _memoryDb = configServices .GetRequiredService <MatchDayAppContext>() .SeedFakeData(); _usuarioRepositorio = new UsuarioRepositorio(_memoryDb); _usuarioTest = _memoryDb.Usuarios.First(); string salt = SenhaHasherHelper.CriarSalt(8); _usuarioFake = new Faker <Usuario>() .RuleFor(u => u.Nome, f => f.Person.FirstName) .RuleFor(u => u.Sobrenome, f => f.Person.LastName) .RuleFor(u => u.Email, f => f.Person.Email) .RuleFor(u => u.Telefone, f => f.Person.Phone) .RuleFor(u => u.Username, f => f.UniqueIndex + f.Person.UserName) .RuleFor(u => u.Senha, f => SenhaHasherHelper.GerarHash(f.Internet.Password(), salt)) .RuleFor(u => u.Salt, salt) .RuleFor(u => u.TipoUsuario, TipoUsuario.Jogador); _usuarioEsperado = new { Nome = "Test", Sobrenome = "One", Username = "******", Email = "*****@*****.**", Telefone = "+551155256325", TipoUsuario = TipoUsuario.ProprietarioQuadra, }; }
public MarathonReminderService(ulong statusChannelId, string eventName) { _serviceProvider = ServicesConfiguration.GetServiceProvider(); StatusChannelId = statusChannelId; EventName = eventName; _filePath = $"{eventName}{Separator}"; }
protected ServerConnectionInformation GetServerConnectionInformation(ServerType serverType) { var connectionInformation = ServicesConfiguration.GetInstance().GetConnectionInformation(serverType); var peerConnectionInformation = NetworkConfiguration.GetInstance().GetPeerConnectionInformation(connectionInformation); return(new ServerConnectionInformation(serverType, peerConnectionInformation)); }
void HandleConfigValues(object sender, ValueChangedEventArgs args) { if (args.DatabaseError != null) { Debug.LogError(args.DatabaseError.Message); } else { if (args.Snapshot != null && args.Snapshot.ChildrenCount > 0) { foreach (var childSnapshot in args.Snapshot.Children.Reverse()) { if (childSnapshot.Child("enable_tappx") == null || childSnapshot.Child("enable_tappx").Value == null) { Debug.Log("<color=red>Bad data in sample. No Data or Did you forget to call SetEditorDatabaseUrl with your project id?</color>"); GameManager.instance.SetServicesConfiguration(false); break; } else { #if !UNITY_EDITOR ServicesConfiguration.enable_tappx = bool.Parse(childSnapshot.Child("enable_tappx").Value.ToString()); #endif ServicesConfiguration.mainscreen_video_is_rewarded = bool.Parse(childSnapshot.Child("mainscreen_video_is_rewarded").Value.ToString()); ServicesConfiguration.sendscore_video_is_rewarded = bool.Parse(childSnapshot.Child("sendscore_video_is_rewarded").Value.ToString()); Debug.Log(ServicesConfiguration.DataToString()); GameManager.instance.SetServicesConfiguration(true); } } } } }
/// <summary>启动</summary> public static void Start() { try { ServicesConfiguration configuration = ServicesConfigurationView.Instance.Configuration; foreach (NameTypeConfigurationElement service in configuration.Services) { EventLogHelper.Information("正在创建服务【" + service.Name + "】。"); if (service.Type == null) { EventLogHelper.Error(string.Format("服务【{0}】初始化类型【{1}】失败,请确认配置是否正确。", service.Name, service.TypeName)); } else { OpenHost(service.Type); } } } catch (Exception ex) { EventLogHelper.Error(ex.ToString()); throw ex; } }
public QuadraFutebolRepositorioTeste() { var configServices = ServicesConfiguration.Configure(); _memoryDb = configServices .GetRequiredService <MatchDayAppContext>() .SeedFakeData(); _quadraFutebolRepositorio = new QuadraFutebolRepositorio(_memoryDb); _quadraTeste = _memoryDb.Quadras.First(); _quadrasFake = new Faker <QuadraFutebol>() .RuleFor(sc => sc.Nome, f => f.Company.CompanyName()) .RuleFor(sc => sc.Imagem, f => f.Image.PicsumUrl()) .RuleFor(sc => sc.PrecoHora, f => f.Random.Decimal(80M, 200M)) .RuleFor(sc => sc.Telefone, f => f.Phone.PhoneNumber("(##) ####-####")) .RuleFor(sc => sc.Endereco, f => f.Address.FullAddress()) .RuleFor(sc => sc.Cep, f => f.Address.ZipCode("#####-###")) .RuleFor(sc => sc.Latitude, f => f.Address.Latitude()) .RuleFor(sc => sc.Longitude, f => f.Address.Longitude()) .RuleFor(sc => sc.UsuarioProprietarioId, f => _memoryDb.Usuarios.First().Id); _quadraEsperada = new { Nome = "Soccer Court 3", Imagem = "soccerCourt3.png", PrecoHora = 90M, Telefone = "(11) 3692-1472", Endereco = "Av. teste 321, teste", Cep = "01012-345", Latitude = -23.1096504, Longitude = -46.533172, }; }
public void Reload() { this.configuration = ServicesConfigurationView.Instance.Configuration; this.trackRunTime = ServicesConfigurationView.Instance.TrackRunTime; this.nextRunTime = this.configuration.Observers[this.Name].NextRunTime; }
public ServicoNotificacaoEmailTeste() { var configServices = ServicesConfiguration.Configure(); var logger = configServices.GetRequiredService <ILogger>(); var smtpSettings = configServices.GetRequiredService <SmtpConfiguracao>(); _emailServico = new ServicoNotificacaoEmail(smtpSettings, logger); }
protected BaseServiceTokenHandler(IOptions <AzureAdConfiguration> azureAdConfiguration, IOptions <ServicesConfiguration> servicesConfiguration, IMemoryCache memoryCache, ITokenProvider tokenProvider) { _azureAdConfiguration = azureAdConfiguration.Value; ServicesConfiguration = servicesConfiguration.Value; _memoryCache = memoryCache; _tokenProvider = tokenProvider; }
public PostRepositoryTest() { var configServices = ServicesConfiguration.Configure(); _inMemoryDbContext = configServices .GetRequiredService <DataContext>() .SeedTestData(); _postRepository = new PostRepository(_inMemoryDbContext); }
public ServicoNotificacaoSmsTeste() { var configServices = ServicesConfiguration.Configure(); var logger = configServices.GetRequiredService <ILogger>(); _twilioSettings = configServices.GetRequiredService <TwilioConfiguracao>(); _smsServico = new ServicoNotificacaoSms(_twilioSettings, logger); }
public MarathonReminderService(IServiceProvider services) : base(services) { if (_serviceProvider == null) { _serviceProvider = ServicesConfiguration.GetServiceProvider(); } _filePath = $"{EventName}{Separator}"; }
public RedisConversationSubscriptionManager(IOptions <ServicesConfiguration> config) { if (config is null) { throw new ArgumentNullException(nameof(config)); } _servicesConfig = config.Value; }
public void Should_return_not_found() { _servicesConfiguration = null; _controller = new SelfTestController(Options.Create(_servicesConfiguration), _mockLogger.Object); var response = (NotFoundResult)_controller.GetPexipServicesConfiguration(); response.StatusCode.Should().Be((int)HttpStatusCode.NotFound); }
public AutenticacaoHandlerTeste() { var cfg = ServicesConfiguration.Configure(); cfg.GetRequiredService <MatchDayAppContext>() .SeedFakeData(); _mediator = cfg.GetRequiredService <IMediator>(); }
// 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; }); services.AddDbContext <ChameleonStoreContext>(options => options.UseSqlServer( Configuration.GetConnectionString("ChameleonStore"))); services .AddIdentity <User, IdentityRole>() .AddDefaultUI() .AddDefaultTokenProviders() .AddEntityFrameworkStores <ChameleonStoreContext>(); services .AddAuthentication() .AddFacebook(options => { options.AppId = this.Configuration.GetSection("ExternalAuthentication:Facebook:AppId").Value; options.AppSecret = this.Configuration.GetSection("ExternalAuthentication:Facebook:AppSecret").Value; }) .AddGoogle(options => { options.ClientId = this.Configuration.GetSection("ExternalAuthentication:Google:ClientId").Value; options.ClientSecret = this.Configuration.GetSection("ExternalAuthentication:Google:ClientSecret").Value; }); services.Configure <IdentityOptions>(options => { options.Password = new PasswordOptions() { RequiredLength = 5, RequiredUniqueChars = 2, RequireLowercase = true, RequireDigit = true, RequireUppercase = true, RequireNonAlphanumeric = true }; options.SignIn.RequireConfirmedEmail = true; }); services.AddAutoMapper(); services.AddSession(); ServicesConfiguration.RegisterAll(services); services .AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public AuthorServiceTest() { var configServices = ServicesConfiguration.Configure(); _dbContext = configServices .GetRequiredService <DataContext>() .SeedTestData(); _unit = configServices.GetService <IUnitOfWork>(); _authorService = new AuthorService(_unit); }
public PostServiceTest() { var provider = ServicesConfiguration.Configure(); _dbContext = provider .GetRequiredService <DataContext>() .SeedTestData(); _unit = provider.GetService <IUnitOfWork>(); _postService = new PostService(_unit); }
public UsuarioHandlerTeste() { var cfg = ServicesConfiguration.Configure(); _memoryDb = cfg.GetRequiredService <MatchDayAppContext>() .SeedFakeData(); _mediator = cfg.GetRequiredService <IMediator>(); _usuarioId = _memoryDb.Usuarios.Last().Id; }
public ConfirmacaoEmailRepositorioTeste() { var configServices = ServicesConfiguration.Configure(); _memoryDb = configServices .GetRequiredService <MatchDayAppContext>() .SeedFakeData(); _confirmacaoEmailRepositorio = new ConfirmacaoEmailRepositorio(_memoryDb); }
public PartidaHandlerTeste() { var cfg = ServicesConfiguration.Configure(); _memoryDb = cfg.GetRequiredService <MatchDayAppContext>() .SeedFakeData(); _mediator = cfg.GetRequiredService <IMediator>(); _partidaId = _memoryDb.Partidas.Last().Id; }
public void Should_map_all_properties() { var pexipConfig = new ServicesConfiguration(); pexipConfig.PexipSelfTestNode = "self-test.node"; var response = PexipConfigurationMapper.MapPexipConfigToResponse(pexipConfig); response.PexipSelfTestNode.Should().BeEquivalentTo(pexipConfig.PexipSelfTestNode); }
public ImageReadyHandler( IBus bus, IHttpClientFactory httpClientFactory, IOptions <ServicesConfiguration> servicesConfiguration, ILogger <ImageReadyHandler> logger) { _bus = bus; _httpClientFactory = httpClientFactory; _servicesConfiguration = servicesConfiguration.Value; _logger = logger; }
public VideoServiceTokenHandler( IOptions <AzureAdConfiguration> azureAdConfigurationOptions, IOptions <ServicesConfiguration> servicesSonConfigurationOptions, IMemoryCache memoryCache, IAzureTokenProvider azureTokenProvider) { _azureAdConfiguration = azureAdConfigurationOptions.Value; _servicesConfiguration = servicesSonConfigurationOptions.Value; _memoryCache = memoryCache; _azureTokenProvider = azureTokenProvider; }