Exemple #1
0
        public async Task RunClassificationForQuery_TestMethod()
        {
            int expected = 1;
            int actual   = 0;

            Query testQuery = new Query("Bank",
                                        "Get Available Balance",
                                        "QRY-TEST-A0007"
                                        );

            // Add a projection-requested event
            await testQuery.RequestClassification("Bank",
                                                  "Account",
                                                  "A-001-223456-B",
                                                  "In Credit",
                                                  null,
                                                  null);

            // Perform the projection request
            ClassifierRequestedEventGridEventData clsReq = new ClassifierRequestedEventGridEventData()
            {
                Commentary        = "This is a unit test",
                DomainName        = testQuery.DomainName,
                EntityTypeName    = testQuery.QueryName,
                InstanceKey       = testQuery.UniqueIdentifier,
                ClassifierRequest =
                    new Common.CQRS.ClassifierHandler.Events.ClassifierRequested()
                {
                    DomainName         = "Bank",
                    EntityTypeName     = "Account",
                    InstanceKey        = "A-001-223456-B",
                    ClassifierTypeName = "In Credit"
                }
            };

            await ClassifierHandlerFunctions.RunClassificationForQuery(clsReq);

            // Add an unprocessed request so that we have something to verify was not processed
            await testQuery.RequestClassification("Bank",
                                                  "Account",
                                                  "B-001-223456-B",
                                                  "In Credit",
                                                  null,
                                                  null);

            // Now check that there was a classifier response...
            var outstanding = await testQuery.GetOutstandingClassifiers();

            if (outstanding != null)
            {
                actual = outstanding.Count();
            }

            //clean up the event stream
            await testQuery.Delete();

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void ClassificationRequestEventGridData_WithData_TestMethod()
        {
            ClassifierRequestedEventGridEventData testObj = new ClassifierRequestedEventGridEventData()
            {
                Commentary        = "This is a unit test classification request",
                DomainName        = "Bank",
                EntityTypeName    = "Query",
                InstanceKey       = "QRY-1234-6567",
                ClassifierRequest = new Common.CQRS.ClassifierHandler.Events.ClassifierRequested()
                {
                    ClassifierTypeName    = "Balance Below Threshold",
                    DomainName            = "Bank",
                    EntityTypeName        = "Account",
                    InstanceKey           = "A-001-223456-B",
                    CorrelationIdentifier = "Test-123"
                                            // Parameters ..?
                }
            };

            Assert.IsNotNull(testObj);
        }