public bool Equals(SortOrder other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return Equals(other.fieldName, fieldName) && Equals(other.order, order); }
public void Sort() { var conn = new MockConnection(new Dictionary<string, string> { {"fq", "id:0"}, {"q", "*:*"}, {"rows", "100000000"}, }); var mocks = new MockRepository(); var queryExec = mocks.StrictMock<ISolrQueryExecuter<Document>>(); var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<Document>>(); ISolrBasicReadOnlyOperations<Document> solr = new SolrBasicServer<Document>(conn, queryExec, docSerializer, null, null, null, null, null); int priceVal = 1; DateTime dt = new DateTime(2011, 1, 1); var linqQuery = from doc in solr.AsQueryable() where (doc.Price >= priceVal || doc.Timestamp >= dt) orderby doc.Id, doc.Price descending select doc; QueryOptions qo; var resDocs = ((IQueryableSolrNet<Document>)linqQuery).GetSolrQuery(out qo); Assert.AreEqual(qo.OrderBy.Count, 2); var so = new SortOrder("id", Order.ASC); Assert.IsTrue(qo.OrderBy.Contains(so)); so = new SortOrder("price", Order.DESC); Assert.IsTrue(qo.OrderBy.Contains(so)); }