Esempio n. 1
0
        public void ExecuteWithAllOptions()
        {
            var mocks = new MockRepository();
            var conn = mocks.StrictMock<ISolrConnection>();

            With.Mocks(mocks).Expecting(() =>
            {
                conn.Post("/update", "<commit waitSearcher=\"true\" waitFlush=\"true\" expungeDeletes=\"true\" maxSegments=\"2\" />");
                LastCall.On(conn).Repeat.Once().Do(new Writer(delegate(string ignored, string s)
                {
                    Console.WriteLine(s);
                    return null;
                }));
            }).Verify(() =>
            {
                var cmd = new CommitCommand
                              {
                                  MaxSegments = 2,
                                  ExpungeDeletes = true,
                                  WaitFlush = true,
                                  WaitSearcher = true
                              };
                cmd.Execute(conn);
            });
        }
Esempio n. 2
0
 public void ExecuteWithBasicOptions() {
     var conn = new Mocks.MSolrConnection();
     conn.post += (url, content) => {
         Assert.AreEqual("/update", url);
         Assert.AreEqual("<commit waitSearcher=\"true\" waitFlush=\"true\" />", content);
         Console.WriteLine(content);
         return null;
     };
     var cmd = new CommitCommand { WaitFlush = true, WaitSearcher = true };
     cmd.Execute(conn);
     Assert.AreEqual(1, conn.post.Calls);
 }
Esempio n. 3
0
 public void ExecuteBasic() {
     var conn = new Mocks.MSolrConnection();
     conn.post += (url, content) => {
         Assert.AreEqual("/update", url);
         Assert.AreEqual("<commit />", content);
         Console.WriteLine(content);
         return null;
     };
     var cmd = new CommitCommand();
     cmd.Execute(conn);
     Assert.AreEqual(1, conn.post.Calls);
 }
Esempio n. 4
0
        public void ExecuteBasic()
        {
            var mocks = new MockRepository();
            var conn = mocks.StrictMock<ISolrConnection>();

            With.Mocks(mocks).Expecting(() =>
            {
                conn.Post("/update", "<commit />");
                LastCall.On(conn).Repeat.Once().Do(new Writer(delegate(string ignored, string s)
                {
                    Console.WriteLine(s);
                    return null;
                }));
            }).Verify(() =>
            {
                var cmd = new CommitCommand();
                cmd.Execute(conn);
            });
        }
Esempio n. 5
0
        public void ExecuteWithBasicOptions()
        {
            var mocks = new MockRepository();
            var conn = mocks.StrictMock<ISolrConnection>();

            With.Mocks(mocks).Expecting(() =>
            {
                conn.Post("/update", "<commit waitSearcher=\"true\" waitFlush=\"true\" />");
                LastCall.On(conn).Repeat.Once().Do(new Writer(delegate(string ignored, string s)
                {
                    Console.WriteLine(s);
                    return null;
                }));
                Expect.On(conn).Call(conn.ServerURL).Repeat.Any().Return("");
            }).Verify(() =>
            {
                var cmd = new CommitCommand { WaitFlush = true, WaitSearcher = true };
                cmd.Execute(conn);
            });
        }