Пример #1
0
        public void DefaultValueTest()
        {
            Api.IndexFieldProperties sut = null;
            "Given a new index field properties".Given(() => sut = new Api.IndexFieldProperties());

            "'standardanalyzer' should be the default 'SearchAnalyzer'".Then(
                () => sut.SearchAnalyzer.Should().Be("standardanalyzer"));
            "'standardanalyzer' should be the default 'IndexAnalyzer'".Then(
                () => sut.IndexAnalyzer.Should().Be("standardanalyzer"));
            "'analyze' should be true".Then(() => sut.Analyze.Should().BeTrue());
            "'store' should be true".Then(() => sut.Store.Should().BeTrue());
            "'index' should be true".Then(() => sut.Index.Should().BeTrue());
            "'FieldType' should be 'Text'".Then(() => sut.FieldType.Should().Be(Api.FieldType.Text));
            "'FieldTermVector' should be 'StoreTermVectorsWithPositionsandOffsets'".Then(
                () => sut.FieldTermVector.Should().Be(Api.FieldTermVector.StoreTermVectorsWithPositionsandOffsets));
        }
Пример #2
0
        public void StorePropertyCanbeSetToFalse(Interface.IFactoryCollection factory)
        {
            Api.IndexFieldProperties indexFieldProperties = null;
            "Given an index field validator and index field properties".Given(
                () =>
                {
                    indexFieldProperties = new Api.IndexFieldProperties();
                    indexFieldProperties.FieldType = Api.FieldType.Date;
                    indexFieldProperties.Store = false;
                });

            "when a field is validated".When(() => { });

            "then there should be no validation error for 'Store'".Then(
                () =>
                    Assert.DoesNotThrow(
                        () =>
                            Validator.IndexFieldValidator(
                                factory,
                                new Api.AnalyzerDictionary(),
                                new Api.ScriptDictionary(),
                                "",
                                indexFieldProperties)));
        }
Пример #3
0
        public void CorrectAnalyzersShouldBeSpecifiedForXFieldtypes1(
            Api.FieldType fieldType,
            string analyzer,
            Interface.IFactoryCollection factory)
        {
            Api.IndexFieldProperties indexFieldProperties = null;
            "Given an index field validator and index field properties".Given(
                () =>
                {
                    indexFieldProperties = new Api.IndexFieldProperties();
                    indexFieldProperties.FieldType = fieldType;
                });

            string.Format(
                "when a field of type '{0}' is validated with 'IndexAnalyzer' & SearchAnalyzer value of '{1}' which is correct",
                fieldType,
                analyzer).When(() => { });

            "then there should be no validation error for 'IndexAnalyzer'".Then(
                () =>
                {
                    indexFieldProperties.IndexAnalyzer = analyzer;
                    Assert.DoesNotThrow(
                        () =>
                            Validator.IndexFieldValidator(
                                factory,
                                new Api.AnalyzerDictionary(),
                                new Api.ScriptDictionary(),
                                "",
                                indexFieldProperties));
                });

            "then there should be no validation error for 'SearchAnalyzer'".Then(
                () =>
                {
                    indexFieldProperties.SearchAnalyzer = analyzer;
                    Assert.DoesNotThrow(
                        () =>
                            Validator.IndexFieldValidator(
                                factory,
                                new Api.AnalyzerDictionary(),
                                new Api.ScriptDictionary(),
                                "",
                                indexFieldProperties));
                });
        }