Beispiel #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);
        }
Beispiel #2
0
        public void Validate()
        {
            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.GetSchema())
                .Repeat.Once()
                .Return(new SolrSchema());
                Expect.Call(validationManager.EnumerateValidationResults(typeof(TestDocument), new SolrSchema()))
                .Repeat.Once()
                .IgnoreArguments()
                .Return(new List <ValidationResult>());
            })
            .Verify(() => {
                var s = new SolrServer <TestDocument>(basicServer, mapper, validationManager);
                s.EnumerateValidationResults().ToList();
            });
        }
Beispiel #3
0
 public void Validate()
 {
     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.GetSchema())
                 .Repeat.Once()
                 .Return(new SolrSchema());
             Expect.Call(validationManager.EnumerateValidationResults(typeof(TestDocument), new SolrSchema()))
                 .Repeat.Once()
                 .IgnoreArguments()
                 .Return(new List<ValidationResult>());
         })
         .Verify(() => {
             var s = new SolrServer<TestDocument>(basicServer, mapper, validationManager);
             s.EnumerateValidationResults().ToList();
         });
 }
Beispiel #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);
 }