コード例 #1
0
        public void AddBaseTable_ShouldUpdateIsFilterableProperty()
        {
            #region Arrange

            var visibleFields = new[] { BaseField1Name, BaseField3Name };

            var queryGenerator = new SearchQueryGeneratorTest();
            queryGenerator.SetNonFilteredColumns(null);
            queryGenerator.ResultColumns.AddRange(visibleFields);
            queryGenerator.LimitResultColumns = true;

            var baseProcessdefinition = new ProcessDefinition();
            var baseTableDefinition = new TableDefinition("TestBaseProcess");
            baseProcessdefinition.TableList.Insert(0, baseTableDefinition);
            baseTableDefinition.AddField(BaseField1Name, ColumnTypes.Numeric, null, true, true);
            baseTableDefinition.AddField(BaseField2Name, ColumnTypes.Object, null, true, true);
            baseTableDefinition.AddField(BaseField3Name, ColumnTypes.Object, null, true, false);

            #endregion Arrange

            // Act
            queryGenerator.AddBaseTable(baseProcessdefinition);

            // Assert
            Assert.IsTrue(queryGenerator.BaseFieldIsFilterable(BaseField1Name));
            Assert.IsFalse(queryGenerator.BaseFieldIsFilterable(BaseField2Name));
            Assert.IsFalse(queryGenerator.BaseFieldIsFilterable(BaseField3Name));
        }
コード例 #2
0
        public void IsColumnExcludedFromSearchFilterTest()
        {
            // Arrange
            var queryGenerator = new SearchQueryGeneratorTest();

            // Act
            queryGenerator.SetNonFilteredColumns(null);

            // Assert
            Assert.IsFalse(queryGenerator.IsColumnExcludedFromSearchFilter(BaseField1Name));

            // Act
            queryGenerator.SetNonFilteredColumns(new[] { BaseField1Name, BaseField2Name });

            // Assert
            Assert.IsTrue(queryGenerator.IsColumnExcludedFromSearchFilter(BaseField1Name));
            Assert.IsFalse(queryGenerator.IsColumnExcludedFromSearchFilter(BaseField3Name));
        }
コード例 #3
0
        public void SetNonFilteredColumnsTest()
        {
            // Arrange
            var queryGenerator = new SearchQueryGeneratorTest();

            // Act
            queryGenerator.SetNonFilteredColumns(null);

            // Assert
            Assert.IsNull(queryGenerator.NonFilteredColumns);

            // Act
            queryGenerator.SetNonFilteredColumns(new[] { BaseField1Name, BaseField2Name });

            // Assert
            Assert.AreEqual(queryGenerator.NonFilteredColumns.Count(), 2);
            Assert.IsTrue(queryGenerator.NonFilteredColumns.Contains(BaseField1Name));
            Assert.IsTrue(queryGenerator.NonFilteredColumns.Contains(BaseField2Name));
        }
コード例 #4
0
        public void AddReferencesFiltered_ShouldUpdateIsFilterableProperty()
        {
            #region Arrange

            var visibleFields = new string[0];

            var queryGenerator = new SearchQueryGeneratorTest();
            queryGenerator.SetNonFilteredColumns(new [] { CrField2Name, McrField2Name, RcrField2Name });

            var processdefinition = new ProcessDefinition();
            var tableDefinition = new TableDefinition("TestProcess");
            processdefinition.TableList.Insert(0, tableDefinition);
            processdefinition.SingleCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.Reference,
                    SystemName = CrField1Name,
                    IsFilterable = true
                });
            processdefinition.SingleCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.Reference,
                    SystemName = CrField2Name,
                    IsFilterable = true
                });
            processdefinition.SingleCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.Reference,
                    SystemName = CrField3Name,
                    IsFilterable = false
                });

            processdefinition.MultiCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.MultiReference,
                    SystemName = McrField1Name,
                    IsFilterable = true
                });
            processdefinition.MultiCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.MultiReference,
                    SystemName = McrField2Name,
                    IsFilterable = true
                });
            processdefinition.MultiCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.MultiReference,
                    SystemName = McrField3Name,
                    IsFilterable = false
                });

            processdefinition.ReverseCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.ReverseReference,
                    SystemName = RcrField1Name,
                    IsFilterable = true
                });
            processdefinition.ReverseCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.ReverseReference,
                    SystemName = RcrField2Name,
                    IsFilterable = true
                });
            processdefinition.ReverseCrossReferenceFields.Add(
                new ReferenceFieldDefinition
                {
                    ColumnType = ColumnTypes.ReverseReference,
                    SystemName = RcrField3Name,
                    IsFilterable = false
                });

            #endregion Arrange

            // Act
            queryGenerator.AddReferences(processdefinition);

            // Assert
            Assert.IsTrue(queryGenerator.SingleCrossReferenceIsFilterable(CrField1Name));
            Assert.IsFalse(queryGenerator.SingleCrossReferenceIsFilterable(CrField2Name));
            Assert.IsFalse(queryGenerator.SingleCrossReferenceIsFilterable(CrField3Name));

            Assert.IsTrue(queryGenerator.MultiCrossReferenceIsFilterable(McrField1Name));
            Assert.IsFalse(queryGenerator.MultiCrossReferenceIsFilterable(McrField2Name));
            Assert.IsFalse(queryGenerator.MultiCrossReferenceIsFilterable(McrField3Name));

            Assert.IsTrue(queryGenerator.ReverseCrossReferenceIsFilterable(RcrField1Name));
            Assert.IsFalse(queryGenerator.ReverseCrossReferenceIsFilterable(RcrField2Name));
            Assert.IsFalse(queryGenerator.ReverseCrossReferenceIsFilterable(RcrField3Name));
        }