public void ParameterFieldsCanBeIgnored()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(addPresetTransactionFields: false);
            var dto         = new DepositDto();

            Assert.Null(searchIndex.Field(nameof(dto.Approver)));
        }
        public void WillAddParametersToSearchData_ButWillNotBeSearchableByDefault()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(addPresetTransactionFields: false);
            var dto         = new DepositDto();

            var amountField = searchIndex.Field(nameof(dto.Amount));

            Assert.Equal(dto.Amount, amountField.GetValue(dto));
            Assert.False(amountField.IsSearchable);
        }
        public void AllowsSearchCustomisationOfParameterFields()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(addPresetTransactionFields: false);
            var dto         = new DepositDto();

            var currencyField = searchIndex.Field(nameof(dto.Currency));

            Assert.Equal(dto.Currency, currencyField.GetValue(dto));
            Assert.True(currencyField.IsFacetable);
            Assert.True(currencyField.IsFilterable);
        }
        public void APrimaryKeyFieldCanBeConfigured()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(addPresetTransactionFields: false);
            var dto         = new DepositDto();

            var idField = searchIndex.Field(nameof(dto.Id));

            Assert.True(idField.IsKey);
            Assert.True(idField.IsSearchable);
            Assert.Equal(dto.Id, idField.GetValue(dto));
        }
        public void CanIncludeNonParameterFieldsWithSearchFieldAttribute()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(addPresetTransactionFields: false);
            var dto         = new DepositDto {
                Category = "test"
            };

            var categoryField = searchIndex.Field(nameof(dto.Category));

            Assert.True(categoryField.IsFacetable);
            Assert.True(categoryField.IsFilterable);
            Assert.Equal(dto.Category, categoryField.GetValue(dto));
        }
        public void UserDefinedPrimaryKeysOverridePresets()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(
                addPresetTransactionFields: true);

            var dto = new DepositDto();

            var uidField = searchIndex.Field(PresetSearchFieldName.tx_uid);

            Assert.False(uidField.IsKey);

            Assert.Equal(nameof(dto.Id), searchIndex.KeyField().Name);
        }