// GET: Rating public ActionResult Index() { RatingList ratings = new RatingList(); ratings.Load(); return(View(ratings)); }
public void LoadTest() { RatingList ratings = new RatingList(); ratings.Load(); int expected = 5; int actual = ratings.Count; Assert.AreEqual(expected, actual); }
public void DeleteTest() { RatingList ratings = new RatingList(); ratings.Load(); //Find the rating with the description testingrating Rating rating = ratings.FirstOrDefault(f => f.Description == "updt"); //Delete it int result = rating.Delete(); Assert.IsTrue(result == 1); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ratings = new RatingList(); ratings.Load(); Reload(); //pretend someone clicked in the ddlRatings, send it with the sender and the e from this event ddlRatings_SelectedIndexChanged(sender, e); //Load data into the session Session["ratings"] = ratings; } else { //is a PostBack, kept in session, get the objects ratings = (RatingList)Session["ratings"]; } }