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); }
public void AddWithBoost_single_doc_calls_operations_with_null_add_parameters() { var mocks = new MockRepository(); var basicServer = mocks.StrictMock<ISolrBasicOperations<TestDocument>>(); var mapper = mocks.StrictMock<IReadOnlyMappingManager>(); var validationManager = mocks.StrictMock<IMappingValidator>(); With.Mocks(mocks) .Expecting(() => Expect.Call( basicServer.AddWithBoost(Arg<IEnumerable<KeyValuePair<TestDocument, double?>>>.Is.Anything, Arg<AddParameters>.Is.Null)) .Repeat.Once()) .Verify(() => { var s = new SolrServer<TestDocument>(basicServer, mapper, validationManager); var t = new TestDocument(); s.AddWithBoost(t, 2.1); }); }
public void AddWithBoost_single_doc_with_add_parameters_calls_operations_with_same_add_parameters() { var basicServer = new MSolrBasicOperations<TestDocument>(); var parameters = new AddParameters { CommitWithin = 4343 }; var t = new TestDocument(); basicServer.addWithBoost += (docs, p) => { Assert.AreSame(parameters, p); var ldocs = docs.ToList(); Assert.AreEqual(1, ldocs.Count); var doc = ldocs[0]; Assert.AreEqual(2.1, doc.Value); Assert.AreSame(t, doc.Key); return null; }; var s = new SolrServer<TestDocument>(basicServer, null, null); s.AddWithBoost(t, 2.1, parameters); Assert.AreEqual(1, basicServer.addWithBoost.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 AddWithBoost_single_doc_calls_operations_with_null_add_parameters() { var mocks = new MockRepository(); var basicServer = mocks.StrictMock <ISolrBasicOperations <TestDocument> >(); var mapper = mocks.StrictMock <IReadOnlyMappingManager>(); var validationManager = mocks.StrictMock <IMappingValidator>(); With.Mocks(mocks) .Expecting(() => Expect.Call( basicServer.AddWithBoost(Arg <IEnumerable <KeyValuePair <TestDocument, double?> > > .Is.Anything, Arg <AddParameters> .Is.Null)) .Repeat.Once()) .Verify(() => { var s = new SolrServer <TestDocument>(basicServer, mapper, validationManager); var t = new TestDocument(); s.AddWithBoost(t, 2.1); }); }
public void AddWithBoost_single_doc_with_add_parameters_calls_operations_with_same_add_parameters() { var basicServer = new MSolrBasicOperations <TestDocument>(); var parameters = new AddParameters { CommitWithin = 4343 }; var t = new TestDocument(); basicServer.addWithBoost += (docs, p) => { Assert.Same(parameters, p); var ldocs = docs.ToList(); Assert.Equal(1, ldocs.Count); var doc = ldocs[0]; Assert.Equal(2.1, doc.Value); Assert.Same(t, doc.Key); return(null); }; var s = new SolrServer <TestDocument>(basicServer, null, null); s.AddWithBoost(t, 2.1, parameters); Assert.Equal(1, basicServer.addWithBoost.Calls); }