public async Task RunProjectionForQuery_TestMethod() { int expected = 1; int actual = 0; Query testQuery = new Query("Bank", "Get Available Balance", "QRY-TEST-A0004" ); // Add a projection-requested event await testQuery.RequestProjection("Bank", "Account", "A-001-223456-B", "Balance", null); // Perform the projection request ProjectionRequestedEventGridEventData projReq = new ProjectionRequestedEventGridEventData() { Commentary = "This is a unit test", DomainName = testQuery.DomainName, EntityTypeName = testQuery.QueryName, InstanceKey = testQuery.UniqueIdentifier, ProjectionRequest = new Common.CQRS.ProjectionHandler.Events.ProjectionRequested() { ProjectionDomainName = "Bank", ProjectionEntityTypeName = "Account", ProjectionInstanceKey = "A-001-223456-B", ProjectionTypeName = "Balance" } }; await ProjectionHandlerFunctions.RunProjectionForQuery(projReq); // Add an unprocessed request so that we have something to verify was not processed await testQuery.RequestProjection("Bank", "Account", "B-001-223456-B", "Balance", null); // Now check that there was a projection response... var outstanding = await testQuery.GetOutstandingProjections(); if (outstanding != null) { actual = outstanding.Count(); } // clean up the event stream await testQuery.Delete(); Assert.AreEqual(expected, actual); }
public async Task RunProjectionForQuery_TestMethod() { Query testQuery = new Query("Bank", "Get Available Balance", "QRY-TEST-A0001" ); // Add a projection-requested event await testQuery.RequestProjection("Bank", "Account", "A-001-223456-B", "Balance", null); // Perform the projection request ProjectionRequestedEventGridEventData projReq = new ProjectionRequestedEventGridEventData() { Commentary = "This is a unit test", DomainName = testQuery.DomainName, EntityTypeName = testQuery.QueryName, InstanceKey = testQuery.UniqueIdentifier, ProjectionRequest = new Common.CQRS.ProjectionHandler.Events.ProjectionRequested() { ProjectionDomainName = "Domain Test", ProjectionEntityTypeName = "Entity Type Test", ProjectionInstanceKey = "Instance 123", ProjectionTypeName = "Mock Projection One" } }; await ProjectionHandlerFunctions.RunProjectionForQuery(projReq); // TODO: Now check that there was a projection response... Assert.IsNotNull(testQuery); }