Exemplo n.º 1
0
        public void AddWithBoost_single_doc_calls_operations_with_null_add_parameters() {
            var basicServer = new MSolrBasicOperations<TestDocument>();
            basicServer.addWithBoost += (a,b) => {
                Assert.IsNull(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.AreEqual(1, basicServer.addWithBoost.Calls);
        }
Exemplo n.º 2
0
        public void Add_single_doc_calls_operations_with_null_add_parameters() {
            var basicServer = new MSolrBasicOperations<TestDocument>();
            basicServer.addWithBoost += (docs, param) => {
                Assert.IsNull(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();
        }
Exemplo n.º 3
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.AreEqual(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.AreEqual(1, basicServer.addWithBoost.Calls);
        }
Exemplo n.º 4
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.AreEqual(1, basicServer.getSchema.Calls);
     Assert.AreEqual(1, validator.enumerate.Calls);
 }