コード例 #1
0
        public void GetPrefixedFieldListShouldIncludeOnlyInResultFileColumns()
        {
            var stub = new SearchQueryGeneratorStub();
            var rootTable = new TableDefinition("test");
            stub.RootTable = rootTable;
            rootTable.AddField("File", ColumnTypes.File);

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[File]"));
            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[FileUrl]"));

            stub.ResultColumns.Add("None");
            stub.LimitResultColumns = true;

            Assert.IsFalse(stub.GetPrefixedFieldListPublic(0, true).Contains("[File]"));
            Assert.IsFalse(stub.GetPrefixedFieldListPublic(0, true).Contains("[FileUrl]"));

            stub.ResultColumns.Add("FileUrl");

            Assert.IsFalse(stub.GetPrefixedFieldListPublic(0, true).Contains("[File]"));
            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[FileUrl]"));

            stub.ResultColumns.Add("File");

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[File]"));
            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[FileUrl]"));
        }
コード例 #2
0
        public void TuneFilters_TuneDateTimeParameterToFilterTimeFields()
        {
            var stub = new SearchQueryGeneratorStub();

            var accessor = new PrivateAccessor(stub);

            var filters = new List<IFilterDescriptor>();

            var dateTime = DateTime.Now;

            var f1 = new FilterDescriptor { Value = dateTime.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) };
            Mock.Arrange(() => f1.FieldName).Returns("CommitTime");
            filters.Add(f1);
            
            var fields = new List<FieldDefinition>();
            var field1 = new FieldDefinition("CommitTime", ColumnTypes.DateTime, new TableDefinition(null), string.Empty, true, true, null, false)
                                {
                                    NameValuesList = new Dictionary<string, object> { { "DateTimeFormat", DateTimeFormat.Time } }
                                };
            fields.Add(field1);
            Mock.NonPublic.Arrange<IEnumerable<FieldDefinition>>(stub, "GetFullFieldList").Returns(fields);

            accessor.CallMethod("TuneFilters", filters);

            Assert.IsTrue(filters.Any(f => (string)f.Value == dateTime.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture)));
        }
コード例 #3
0
        public void GetPrefixedFieldListShouldIncludeOnlyInResultReverseCrossRefColumns()
        {
            var stub = new SearchQueryGeneratorStub();
            var rootTable = new TableDefinition("test");
            stub.RootTable = rootTable;
            stub.ReverseCrossReferences.Add(new ReferenceFieldDefinition { ColumnType = ColumnTypes.ReverseReference, SystemName = "Ref", Name = "RefN", Alias = "RefA", DefinedIn = new ReferenceProcessDefinition() });

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, false).Contains("[RefN]"));

            stub.ResultColumns.Add("None");
            stub.LimitResultColumns = true;

            Assert.IsFalse(stub.GetPrefixedFieldListPublic(0, false).Contains("[RefN]"));

            stub.ResultColumns.Clear();
            stub.ResultColumns.Add("RefN");

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, false).Contains("[RefN]"));

            stub.ResultColumns.Clear();
            stub.ResultColumns.Add("Ref");

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, false).Contains("[RefN]"));
        }
コード例 #4
0
        public void QueryShouldContainJoinToBinaryContentTableIfTableHasImageFields()
        {
            var stub = new SearchQueryGeneratorStub();
            var rootTable = new TableDefinition("test");
            stub.RootTable = rootTable;
            rootTable.AddField("Image", ColumnTypes.Image);

            var query = stub.GenerateQuery();
            Assert.IsTrue(query.Contains(Constants.BinaryContentTableName));
            Assert.IsTrue(query.Contains("[bc0]"));
        }
コード例 #5
0
        public void GetPrefixedFieldListShouldIncludeOnlyInResultRichStringColumns()
        {
            var stub = new SearchQueryGeneratorStub();
            var rootTable = new TableDefinition("test");
            stub.RootTable = rootTable;
            rootTable.AddField("String", ColumnTypes.String, isRichText: true);

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[String]"));

            stub.ResultColumns.Add("None");
            stub.LimitResultColumns = true;

            Assert.IsFalse(stub.GetPrefixedFieldListPublic(0, true).Contains("[String]"));

            stub.ResultColumns.Add("String");

            Assert.IsTrue(stub.GetPrefixedFieldListPublic(0, true).Contains("[String]"));
        }