public void find_first() { var criteria = _genreRepo.Session.CreateCriteria <Genre>(); criteria.Add(Restrictions.Like("Name", "%ck%")); var genre = _genreRepo.FindFirst(criteria); Assert.IsNotNull(genre); Assert.IsTrue(genre.Name.Contains("ck")); }
public void find_first_with_sorts() { var criteria = _invoiceRepo.Session.CreateCriteria <Invoice>(); criteria.Add(Restrictions.Eq("BillingCountry", "Germany")); var sortInvoiceDateDesc = new NHibernateRepositorySort("InvoiceDate", NHibernateRepositorySortDirection.Desc); var sorts = new NHibernateRepositorySortList { sortInvoiceDateDesc }; var invoice = _invoiceRepo.FindFirst(criteria, sorts); Assert.IsNotNull(invoice); Assert.AreEqual("Germany", invoice.BillingCountry); Assert.AreEqual(5.94D, invoice.Total); }