public void CaDetectDistinct()
        {
            var involvedRows = new List <InvolvedRow>
            {
                new InvolvedRow("Table2", 100),
                new InvolvedRow("Table1", 1000),
                new InvolvedRow("Table2", 200)
            };

            var involvedTables =
                new List <InvolvedTable>
            {
                new InvolvedTable("Table2", new RowReference[] { new OIDRowReference(100) }),
                new InvolvedTable("Table1", new RowReference[] { new OIDRowReference(1000) })
            };

            ITable tableMock = ExceptionObjectTestUtils.GetMockTable();

            ExceptionObject exceptionObject = ExceptionObjectTestUtils.CreateExceptionObject(
                1, involvedTables);
            QaError qaError = ExceptionObjectTestUtils.CreateQaError(tableMock, involvedRows);

            var predicate = new ExceptionObjectInvolvedRowsPredicate(null);

            Assert.False(predicate.Matches(exceptionObject, qaError));
        }
Exemplo n.º 2
0
        private static bool Matches([CanBeNull] string exceptionObjectIssueCode,
                                    [CanBeNull] string qaErrorIssueCode)
        {
            ExceptionObject exceptionObject = CreateExceptionObject(1, exceptionObjectIssueCode);
            ITable          table           = ExceptionObjectTestUtils.GetMockTable();
            QaError         qaError         = ExceptionObjectTestUtils.CreateQaError(table, qaErrorIssueCode,
                                                                                     null);

            var predicate = new ExceptionObjectIssueCodePredicate();

            return(predicate.Matches(exceptionObject, qaError));
        }
        private static bool Matches([CanBeNull] string exceptionAffectedComponent,
                                    [CanBeNull] string qaErrorAffectedComponent)
        {
            ExceptionObject exceptionObject = CreateExceptionObject(1,
                                                                    exceptionAffectedComponent);
            ITable  table   = ExceptionObjectTestUtils.GetMockTable();
            QaError qaError = ExceptionObjectTestUtils.CreateQaError(table, null,
                                                                     qaErrorAffectedComponent);

            var predicate = new ExceptionObjectAffectedComponentPredicate();

            return(predicate.Matches(exceptionObject, qaError));
        }
        private static bool Matches(double?doubleValue1, double?doubleValue2,
                                    [CanBeNull] string textValue,
                                    [CanBeNull] IEnumerable <object> values,
                                    double significantDigits = 1E-7,
                                    bool ignoreLeadingAndTrailingWhitespace = true,
                                    bool ignoreCase = false)
        {
            ExceptionObject exceptionObject = CreateExceptionObject(1, doubleValue1,
                                                                    doubleValue2,
                                                                    textValue);
            ITable table = ExceptionObjectTestUtils.GetMockTable();

            QaError qaError = ExceptionObjectTestUtils.CreateQaError(table, null, null, values);

            var predicate = new ExceptionObjectValuesPredicate(significantDigits,
                                                               ignoreLeadingAndTrailingWhitespace,
                                                               ignoreCase);

            return(predicate.Matches(exceptionObject, qaError));
        }
Exemplo n.º 5
0
        public void CanSearch()
        {
            var involvedRows1 = new List <InvolvedRow>
            {
                new InvolvedRow("Table2", 100),
                new InvolvedRow("Table1", 1000),
                new InvolvedRow("Table2", 200)
            };

            var involvedTables1 =
                new List <InvolvedTable>
            {
                new InvolvedTable("Table2",
                                  new RowReference[]
                {
                    new OIDRowReference(200),
                    new OIDRowReference(100)
                }),
                new InvolvedTable("Table1",
                                  new RowReference[]
                {
                    new OIDRowReference(1000)
                })
            };

            var involvedRows2 = new List <InvolvedRow>
            {
                new InvolvedRow("Table1", 1000),
                new InvolvedRow("Table2", 100)
            };

            var involvedTables2 =
                new List <InvolvedTable>
            {
                new InvolvedTable("Table2",
                                  new RowReference[]
                {
                    new OIDRowReference(100)
                }),
                new InvolvedTable("Table1",
                                  new RowReference[]
                {
                    new OIDRowReference(1000)
                })
            };

            var involvedRows3 = new List <InvolvedRow>
            {
                new InvolvedRow("Table3", 1000)
            };

            var exceptionObjects =
                new List <ExceptionObject>
            {
                ExceptionObjectTestUtils.CreateExceptionObject(1, involvedTables2),
                ExceptionObjectTestUtils.CreateExceptionObject(2, involvedTables2),
                ExceptionObjectTestUtils.CreateExceptionObject(3, involvedTables1),
                ExceptionObjectTestUtils.CreateExceptionObject(4, involvedTables1),
                ExceptionObjectTestUtils.CreateExceptionObject(5, involvedTables1)
            };

            var index = new ExceptionObjectInvolvedRowsIndex(null);

            foreach (ExceptionObject exceptionObject in exceptionObjects)
            {
                index.Add(exceptionObject);
            }

            ITable  table    = ExceptionObjectTestUtils.GetMockTable();
            QaError qaError1 = ExceptionObjectTestUtils.CreateQaError(table, involvedRows1);
            QaError qaError2 = ExceptionObjectTestUtils.CreateQaError(table, involvedRows2);
            QaError qaError3 = ExceptionObjectTestUtils.CreateQaError(table, involvedRows3);

            Assert.AreEqual(3, index.Search(qaError1).Count());
            Assert.AreEqual(2, index.Search(qaError2).Count());
            Assert.AreEqual(0, index.Search(qaError3).Count());
        }