public async Task BeforeEachTest()
        {
            const string connectionStringEnvironmentVariable =
                "ASPNETCORE_MyMeetings_IntegrationTests_ConnectionString";

            ConnectionString = EnvironmentVariablesProvider.GetVariable(connectionStringEnvironmentVariable);
            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>();
            ExecutionContext = new ExecutionContextMock(Guid.NewGuid());

            MeetingsStartup.Initialize(
                ConnectionString,
                ExecutionContext,
                Logger,
                new EmailsConfiguration("*****@*****.**"),
                null);

            MeetingsModule = new MeetingsModule();
        }
示例#2
0
        public async Task BeforeEachTest()
        {
            var connectionString =
                EnvironmentVariablesProvider.GetVariable("TinyCommerce_IntegrationTest_ConnectionString");

            if (connectionString == null)
            {
                throw new ApplicationException($"You must provide connection string.");
            }

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

            CustomersStartup.Initialize(connectionString, Logger, EmailSender);
            CustomersModule = new CustomersModule();

            await CustomersModule.ExecuteCommandAsync(new PurgeModuleCommand());
        }