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 async Task ShouldSuccesfullyCreateAndHydrateQueryModel() { // ARRANGE var repository = new DocumentDbQueryModelRepository(_database, _collection, _offerThroughput, _noOfPartitions, _endpoint, _authKey); var queryModelId = Guid.NewGuid(); var testQueryModel = new TestQueryModel(queryModelId, "Hello Integration Test!"); // ACT await repository.Save(testQueryModel); var hydratedQueryModel = await repository.GetById <TestQueryModel>(queryModelId); var existing = await repository.DoesItemExist <TestQueryModel>(queryModelId); // ASSERT Assert.IsTrue(existing); Assert.IsNotNull(hydratedQueryModel); Assert.AreEqual(queryModelId, hydratedQueryModel.id); Assert.AreEqual("Hello Integration Test!", testQueryModel.DummyPayload); Assert.AreEqual(testQueryModel.DummyPayload, hydratedQueryModel.DummyPayload); }