public void SetUp() { // ARRANGE var repository = new CosmosDbQueryModelRepository(_database, _collection, _offerThroughput, _noOfPartitions, _endpoint, _authKey); // ACT repository.Initialize(); // ASSERT }
public void Initialize() { // Configuration Parameters var eventDatabaseConnectionString = "Data Source=localhost;Initial Catalog=eventway;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; var projectionMetadataDatabaseConnectionString = eventDatabaseConnectionString; var cosmosDbEndpoint = "https://localhost:8081"; // This is the default endpoint for local emulator-instances of the Cosmos DB var cosmosDbAuthKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="; var cosmosDbDatabaseId = "eventway"; var cosmosDbCollectionId = "projections"; var offerThroughput = 10000; var noOfPartitions = 1000; // Event Repository var eventRepository = new SqlServerEventRepository(eventDatabaseConnectionString); // Projection Metadata Repository var projectionMetadataRepository = new SqlServerProjectionMetadataRepository(projectionMetadataDatabaseConnectionString); // Query Model Repository var queryModelRepository = new CosmosDbQueryModelRepository(cosmosDbDatabaseId, cosmosDbCollectionId, offerThroughput, noOfPartitions, cosmosDbEndpoint, cosmosDbAuthKey); queryModelRepository.Initialize(); // Event Listener var eventListener = new BasicEventListener(); // Aggregate services var aggregateFactory = new DefaultAggregateFactory(); var aggregateRepository = new AggregateRepository(eventRepository, aggregateFactory); var aggregateStore = new AggregateStore(aggregateRepository, eventListener); // PROJECTIONS UserProjection = new UserProjection( eventRepository, eventListener, queryModelRepository, projectionMetadataRepository); // APPLICATION SERVICES UserApplicationService = new UserApplicationService( aggregateStore, queryModelRepository); // Start listening for events UserProjection.Listen(); }