public PostgresCheckpointManagerTests()
        {
            var fixture = new Fixture();

            _options = fixture.Build <PostgresOptions>()
                       .Without(o => o.Host)
                       .Without(o => o.Port)
                       .Without(o => o.Database)
                       .Without(o => o.Username)
                       .Without(o => o.Password)
                       .Without(o => o.Pooling)
                       .Without(o => o.Schema)
                       .Do(o =>
            {
                o.Host     = Environment.GetEnvironmentVariable("POSTGRES_HOST") ?? "localhost";
                o.Port     = Convert.ToInt32(Environment.GetEnvironmentVariable("POSTGRES_PORT") ?? "5432");
                o.Database = Environment.GetEnvironmentVariable("POSTGRES_DATABASE") ?? "postgres";
                o.Username = Environment.GetEnvironmentVariable("POSTGRES_USERNAME") ?? "postgres";
                o.Password = Environment.GetEnvironmentVariable("POSTGRES_PASSWORD") ?? "postgres";
                o.Pooling  = Convert.ToBoolean(Environment.GetEnvironmentVariable("POSTGRES_POOLING") ?? "False");
                o.Schema   = Environment.GetEnvironmentVariable("POSTGRES_SCHEMA") ?? "public";
            })
                       .Create();

            _connection = new PostgresConnection(_options);

            _sut = new PostgresCheckpointManager(_options, _connection);
        }
Beispiel #2
0
        public PostgresCheckpointManager(PostgresOptions options, IPostgresConnection connection)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));
            _scripts = new Scripts.Scripts(_options.Schema);

            _createConnection = connection.Build;

            CreateSchemaIfNotExists();
        }
Beispiel #3
0
        public IndexModule(IPostgresConnection connection, IApplicationStateRepository appStateRepository)
        {
            var getIndexVmCommand   = new GetIndexVmCommand(appStateRepository);
            var districtsRepository = new DistrictsRepository(connection);
            var schoolsRepository   = new SchoolsRepository(connection);

            Get["/"] = _ => View["index", getIndexVmCommand.Execute()];

            Get["/districts"] = _ => GetAllDistricts(districtsRepository);

            Get["/districts/{districtId}"] = parameters => GetDistrict(districtsRepository, schoolsRepository, parameters);
        }
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            appStateRepository = new ApplicationStateRepository();
            container.Register(appStateRepository);

            connection = new PostgresConnection(appStateRepository.GetPrimaryConnectionString());
            container.Register(connection);

            StaticConfiguration.DisableErrorTraces = !appStateRepository.GetRequiredSetting("showErrorTraces").AsBool();
        }
        public PostgresReadModelUnitOfWorkTests()
        {
            fixture = new Fixture();

            transaction = Substitute.For <IPostgresTransaction>();
            connection  = Substitute.For <IPostgresConnection>();

            connection.BeginTransaction().Returns(transaction);

            connectionFactory = Substitute.For <IPostgresConnectionFactory>();
            connectionFactory.Create(Arg.Any <PostgresConfiguration>()).Returns(connection);
        }
Beispiel #6
0
        public PostgresReadModelUserRepositoryTests()
        {
            fixture = new Fixture();

            parameterCollection = Substitute.For <IPostgresParameterCollection>();
            command             = Substitute.For <IPostgresCommand>();
            transaction         = Substitute.For <IPostgresTransaction>();
            connection          = Substitute.For <IPostgresConnection>();

            command.CreateParameter().Returns(args => Substitute.For <IPostgresParameter>());
            command.Parameters.Returns(parameterCollection);
            connection.CreateCommand().Returns(command);
            connection.BeginTransaction().Returns(transaction);

            repository = new PostgresReadModelUserRepository(connection);
        }
Beispiel #7
0
 public WorldCupRepositoryCSharpV1(IPostgresConnection postgresConnection)
 {
     _postgresConnection = postgresConnection;
 }
Beispiel #8
0
 public PostgresReadModelUserRepository(IPostgresConnection connection)
 {
     Connection = connection;
 }
Beispiel #9
0
 public TraderDocumentsPostgresRepository(IPostgresConnection postgresConnection)
 {
     _postgresConnection = postgresConnection ?? throw new ArgumentNullException(nameof(postgresConnection));
 }
Beispiel #10
0
 public TodoRepository(IPostgresConnection conn)
 {
     _conn = conn;
 }
Beispiel #11
0
 public ImageRepository(IPostgresConnection connection, IMapper mapper)
 {
     this.Connection = connection;
     this.Mapper     = mapper;
 }
Beispiel #12
0
 public EventRepository(IPostgresConnection connection, IMapper mapper)
 {
     this.Mapper     = mapper;
     this.Connection = connection;
 }
Beispiel #13
0
 public WorldCupController2(IPostgresConnection postgresConnection)
 {
     _postgresConnection = postgresConnection;
 }
 public PersonalDataPostgresRepository(IPostgresConnection postgresConnection)
 {
     _postgresConnection = postgresConnection ?? throw new ArgumentNullException(nameof(postgresConnection));
 }
 public DarkSkyLogRepository(IPostgresConnection postgresConnection)
 {
     this.postgresConnection = postgresConnection;
 }
Beispiel #16
0
 public AuthenticationCredentialsPostgresRepository(IPostgresConnection postgresConnection, byte[] initKey, byte[] initVector)
 {
     _postgresConnection = postgresConnection ?? throw new ArgumentNullException(nameof(postgresConnection));
     _initKey            = initKey;
     _initVector         = initVector;
 }
 public DistrictsRepository(IPostgresConnection connection)
 {
     this.connection = connection;
 }
Beispiel #18
0
 public SchoolsRepository(IPostgresConnection connection)
 {
     this.connection = connection;
 }
Beispiel #19
0
 public ToDoItemRepository(IPostgresConnection connection)
 {
     this.connection = connection;
 }
Beispiel #20
0
 public MiniPonicsImageDataRepository(IPostgresConnection postgresConnection)
 {
     this.postgresConnection = postgresConnection;
 }