Пример #1
0
        public async Task BeforeEachTest()
        {
            const string connectionStringEnvironmentVariable =
                "ASPNETCORE_FootballBanter_IntegrationTests_ConnectionString";

            ConnectionString = Environment.GetEnvironmentVariable(connectionStringEnvironmentVariable, EnvironmentVariableTarget.Machine);
            if (ConnectionString == null)
            {
                throw new ApplicationException(
                          $"Define connection string to integration tests database using environment variable: {connectionStringEnvironmentVariable}");
            }


            using (var sqlConnection = new SqlConnection(ConnectionString))
            {
                await ClearDatabase(sqlConnection);
            }

            Logger      = Substitute.For <ILogger>();
            EmailSender = Substitute.For <IEmailSender>();

            MatchesStartup.Initialize(
                ConnectionString,
                new ExecutionContextMock(Guid.NewGuid()),
                Logger,
                new EmailsConfiguration("*****@*****.**", "sendGridUser", "sendGridKey"),
                "key",
                EmailSender,
                null);


            MatchModule = new MatchModule();
        }
Пример #2
0
        private void InitializeModule(ILifetimeScope autofacContainer)
        {
            var emailsConfiguration = new EmailsConfiguration(Configuration["EmailsConfiguration:FromEmail"], Configuration["EmailsConfiguration:SendGridUser"], Configuration["EmailsConfiguration:SendGridKey"]);

            var httpContextAccessor      = autofacContainer.Resolve <IHttpContextAccessor>();
            var executionContextAccessor = new ExecutionContextAccessor(httpContextAccessor);

            var eventBus = new EventBusRabbitMQ(_logger, GetRabbitMQConnection(), "football-banter", "Matches");

            MatchesStartup.Initialize(
                Configuration["ConnectionString"],
                executionContextAccessor,
                _logger,
                emailsConfiguration,
                Configuration["Security:TextEncryptionKey"],
                null,
                eventBus
                );
        }