public async Task ShouldSuccesfullyInitializeDatabaseAndCollection() { // ARRANGE var eventOffset = 0L; var projectionId = CombGuid.Generate(); var projectionType = "IntegrationTestProjection"; // Query Model Repository (DocumentDB) var queryModelRepository = new DocumentDbQueryModelRepository(_database, _collection, _offerThroughput, _noOfPartitions, _endpoint, _authKey); queryModelRepository.Initialize(); // Projection Metadata Repository (MSSQL); var projectionMetadataRepository = new SqlServerProjectionMetadataRepository(_sqlConnectionString); projectionMetadataRepository.InitializeProjection(projectionId, projectionType); // Dummy Query Model var queryModelId = CombGuid.Generate(); var testQueryModel = new TestQueryModel(queryModelId, "Hello Integration Test!"); // Query Model Store var queryModelStore = new QueryModelStore( queryModelRepository, projectionMetadataRepository, eventOffset, projectionId); // ACT await queryModelStore.SaveQueryModel(testQueryModel); // ASSERT }
public void ShouldSuccesfullyCreateAndHydrateProjectionMetadata() { // ARRANGE var repository = new SqlServerProjectionMetadataRepository(_connectionString); var projectionId = CombGuid.Generate(); var projectionType = "TestProjection"; // ACT repository.InitializeProjection(projectionId, projectionType); var hydratedProjectionMetadata = repository.GetByProjectionId(projectionId); // ASSERT Assert.AreEqual(projectionId, hydratedProjectionMetadata.ProjectionId); Assert.AreEqual(0L, hydratedProjectionMetadata.EventOffset); }