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); }
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); }
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(); }
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); }