public void SortTestWithName() { ImageDal dal = new ImageDal(); ImageDetails idetails = new ImageDetails(); idetails.Name = "Lighthouse.jpg"; idetails.Image = new byte[] { }; idetails.Size = 100; dal.AddImage(idetails); ImageDetails idetails1 = new ImageDetails(); idetails.Name = "Desert.jpg"; idetails.Image = new byte[] { }; idetails.Size = 100; dal.AddImage(idetails); int index1 = dal.Sort(1).FindLastIndex(x => x.Name == "Lighthouse.jpg"); int index2 = dal.Sort(1).FindLastIndex(x => x.Name == "Desert.jpg"); Assert.IsTrue(index1 > index2); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { try { if (int.Parse(DropDownList1.SelectedValue) > 0) { ImageDal dal = new ImageDal(); ListView1.DataSource = dal.Sort(int.Parse(DropDownList1.SelectedValue)); ListView1.DataBind(); } } catch (Exception ex) { ImageException exception = new ImageException(ex.Message); } }