Пример #1
0
        public void Add_enumerable_calls_operations_with_null_add_parameters()
        {
            var basicServer = new MSolrBasicOperations <TestDocument>();

            basicServer.addWithBoost += (docs, p) => {
                Assert.Null(p);
                return(null);
            };
            var s = new SolrServer <TestDocument>(basicServer, null, null);
            var t = new[] { new TestDocument(), new TestDocument() };

            s.AddRange(t);
            basicServer.addWithBoost.Verify();
        }
Пример #2
0
        public void Add_enumerable_with_add_parameters_calls_operations_with_same_add_parameters()
        {
            var parameters = new AddParameters {
                CommitWithin = 4343
            };
            var basicServer = new MSolrBasicOperations <TestDocument>();

            basicServer.addWithBoost += (docs, p) => {
                Assert.Same(parameters, p);
                return(null);
            };
            var s = new SolrServer <TestDocument>(basicServer, null, null);
            var t = new[] { new TestDocument(), new TestDocument() };

            s.AddRange(t, parameters);
        }
Пример #3
0
        public void Add_enumerable_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[] { new TestDocument(), new TestDocument() };
                s.AddRange(t);
            });
        }
Пример #4
0
 public void Add_enumerable_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[] { new TestDocument(), new TestDocument() };
             s.AddRange(t);
         });
 }
Пример #5
0
 public void Add_enumerable_with_add_parameters_calls_operations_with_same_add_parameters() {
     var parameters = new AddParameters { CommitWithin = 4343 };
     var basicServer = new MSolrBasicOperations<TestDocument>();
     basicServer.addWithBoost += (docs, p) => {
         Assert.AreSame(parameters, p);
         return null;
     };
     var s = new SolrServer<TestDocument>(basicServer, null, null);
     var t = new[] { new TestDocument(), new TestDocument() };
     s.AddRange(t, parameters);
 }
Пример #6
0
 public void Add_enumerable_calls_operations_with_null_add_parameters() {
     var basicServer = new MSolrBasicOperations<TestDocument>();
     basicServer.addWithBoost += (docs, p) => {
         Assert.IsNull(p);
         return null;
     };
     var s = new SolrServer<TestDocument>(basicServer, null, null);
     var t = new[] { new TestDocument(), new TestDocument() };
     s.AddRange(t);
     basicServer.addWithBoost.Verify();
 }