Esempio n. 1
0
        public void Validate()
        {
            var basicServer = new MSolrBasicOperations <TestDocument>();

            basicServer.getSchema += () => new SolrSchema();
            var validator = new MMappingValidator();

            validator.enumerate &= x => x.Return(new List <ValidationResult>());
            var s = new SolrServer <TestDocument>(basicServer, null, validator);

            s.EnumerateValidationResults().ToList();
            Assert.Equal(1, basicServer.getSchema.Calls);
            Assert.Equal(1, validator.enumerate.Calls);
        }
Esempio n. 2
0
        public void AddWithBoost_single_doc_calls_operations_with_null_add_parameters()
        {
            var basicServer = new MSolrBasicOperations <TestDocument>();

            basicServer.addWithBoost += (a, b) => {
                Assert.Null(b);
                return(null);
            };

            var mapper            = new MReadOnlyMappingManager();
            var validationManager = new MMappingValidator();

            var s = new SolrServer <TestDocument>(basicServer, mapper, validationManager);
            var t = new TestDocument();

            s.AddWithBoost(t, 2.1);

            Assert.Equal(1, basicServer.addWithBoost.Calls);
        }
Esempio n. 3
0
        public void Add_single_doc_calls_operations_with_null_add_parameters()
        {
            var basicServer = new MSolrBasicOperations <TestDocument>();

            basicServer.addWithBoost += (docs, param) => {
                Assert.Null(param);
                return(null);
            };
            basicServer.addWithBoost &= x => x.Expect(1);

            var mapper            = new MReadOnlyMappingManager();
            var validationManager = new MMappingValidator();

            var s = new SolrServer <TestDocument>(basicServer, mapper, validationManager);
            var t = new TestDocument();

            s.Add(t);
            basicServer.addWithBoost.Verify();
        }
Esempio n. 4
0
        public void Add_single_doc_with_add_parameters_calls_operations_with_same_add_parameters()
        {
            var parameters = new AddParameters {
                CommitWithin = 4343
            };
            var basicServer = new MSolrBasicOperations <TestDocument>();

            basicServer.addWithBoost += (_, p) => {
                Assert.Equal(parameters, p);
                return(null);
            };

            var mapper            = new MReadOnlyMappingManager();
            var validationManager = new MMappingValidator();

            var s = new SolrServer <TestDocument>(basicServer, mapper, validationManager);
            var t = new TestDocument();

            s.Add(t, parameters);

            Assert.Equal(1, basicServer.addWithBoost.Calls);
        }