public void DeleteByMultipleId() { var ids = new[] {"123", "456"}; var conn = new Mocks.MSolrConnection(); var xml = string.Format("<delete><id>{0}</id><id>{1}</id></delete>", ids[0], ids[1]); conn.post = conn.post.Args("/update", xml); var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, null, null), null); cmd.Execute(conn); Assert.AreEqual(1, conn.post.Calls); }
public void DeleteById() { const string id = "123123"; var conn = new Mocks.MSolrConnection(); conn.post = conn.post .Args("/update", string.Format("<delete><id>{0}</id></delete>", id)); var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(new[] { id }, null, null), null); cmd.Execute(conn); Assert.AreEqual(1, conn.post.Calls); }
public void DeleteByMultipleId() { var ids = new[] {"123", "456"}; var mocks = new MockRepository(); var conn = mocks.StrictMock<ISolrConnection>(); With.Mocks(mocks).Expecting(delegate { Expect.Call(conn.Post("/update", string.Format("<delete><id>{0}</id><id>{1}</id></delete>", ids[0], ids[1]))).Repeat.Once().Return(""); }).Verify(delegate { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, null, null)); cmd.Execute(conn); }); }
public void DeleteById() { const string id = "123123"; var mocks = new MockRepository(); var conn = mocks.CreateMock<ISolrConnection>(); With.Mocks(mocks).Expecting(delegate { Expect.Call(conn.Post("/update", string.Format("<delete><id>{0}</id></delete>", id))).Repeat.Once().Return(""); }).Verify(delegate { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(new[] {id}, null)); cmd.Execute(conn); }); }
public void DeleteByQuery() { const string queryString = "someQuery"; var q = new SolrQuery(queryString); var xml = string.Format("<delete><query>{0}</query></delete>", queryString); var conn = new Mocks.MSolrConnection(); conn.post = conn.post.Args("/update", xml); var querySerializer = new Mocks.MSolrQuerySerializer(); querySerializer.serialize += _ => queryString; var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(null, q, querySerializer), null); cmd.Execute(conn); Assert.AreEqual(1, conn.post.Calls); }
public void DeleteByIdAndQuery() { var ids = new[] { "123", "456" }; const string queryString = "someQuery"; var xml = string.Format("<delete><id>{0}</id><id>{1}</id><query>{2}</query></delete>", ids[0], ids[1], queryString); var conn = new Mocks.MSolrConnection(); conn.post = conn.post.Args("/update", xml); var q = new SolrQuery(queryString); var querySerializer = new Mocks.MSolrQuerySerializer(); querySerializer.serialize += _ => queryString; var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, q, querySerializer)); cmd.Execute(conn); Assert.AreEqual(1, conn.post.Calls); }
public void DeleteByIdAndQuery() { var ids = new[] { "123", "456" }; var mocks = new MockRepository(); var conn = mocks.CreateMock<ISolrConnection>(); var q = mocks.CreateMock<ISolrQuery>(); With.Mocks(mocks).Expecting(delegate { const string queryString = "someQuery"; Expect.Call(q.Query).Repeat.Once().Return(queryString); Expect.Call(conn.Post("/update", string.Format("<delete><id>{0}</id><id>{1}</id><query>{2}</query></delete>", ids[0], ids[1], queryString))).Repeat.Once(). Return(""); }).Verify(delegate { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, q)); cmd.Execute(conn); }); }
public void DeleteByQuery() { var mocks = new MockRepository(); var conn = mocks.StrictMock<ISolrConnection>(); var q = mocks.StrictMock<ISolrQuery>(); var querySerializer = mocks.StrictMock<ISolrQuerySerializer>(); With.Mocks(mocks).Expecting(delegate { const string queryString = "someQuery"; Expect.On(conn) .Call(conn.Post("/update", string.Format("<delete><query>{0}</query></delete>", queryString))) .Repeat.Once() .Return(""); Expect.On(querySerializer) .Call(querySerializer.Serialize(null)) .IgnoreArguments() .Return(queryString); }).Verify(delegate { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(null, q, querySerializer)); cmd.Execute(conn); }); }
public void DeleteFromCommittedAndFromPending() { const string id = "123123"; var mocks = new MockRepository(); var conn = mocks.StrictMock<ISolrConnection>(); With.Mocks(mocks).Expecting(delegate { Expect.On(conn).Call(conn.Post("/update", string.Format("<delete fromPending=\"false\" fromCommitted=\"false\"><id>{0}</id></delete>", id))) .Repeat.Once() .Return(""); }).Verify(delegate { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(new[] { id }, null, null)) { FromCommitted = false, FromPending = false }; cmd.Execute(conn); }); }
public void DeleteFromCommittedAndFromPending() { const string id = "123123"; var conn = new Mocks.MSolrConnection(); var xml = string.Format("<delete fromPending=\"false\" fromCommitted=\"false\"><id>{0}</id></delete>", id); conn.post = conn.post.Args("/update", xml); var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(new[] { id }, null, null), null) { FromCommitted = false, FromPending = false }; cmd.Execute(conn); Assert.AreEqual(1, conn.post.Calls); }
public void ByQuery(ISolrQuery q) { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(null, q, GetQuerySerializer())); cmd.Execute(connection); }
public void ByIds(IEnumerable<string> ids) { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, null, GetQuerySerializer())); cmd.Execute(connection); }
public void ById(string id) { var cmd = new DeleteCommand(new DeleteByIdAndOrQueryParam(new[] { id }, null, GetQuerySerializer())); cmd.Execute(connection); }
public void ByQuery(ISolrQuery q) { var cmd = new DeleteCommand(new DeleteByQueryParam(q)); cmd.Execute(connection); }
public void ByIds(IEnumerable<string> ids) { var cmd = new DeleteCommand(new DeleteByMultipleIdParam(ids)); cmd.Execute(connection); }
public void ById(string id) { var cmd = new DeleteCommand(new DeleteByMultipleIdParam(new[] {id})); cmd.Execute(connection); }