예제 #1
0
        // GET: Rating
        public ActionResult Index()
        {
            RatingList ratings = new RatingList();

            ratings.Load();
            return(View(ratings));
        }
예제 #2
0
        public void LoadTest()
        {
            RatingList ratings = new RatingList();

            ratings.Load();

            int expected = 5;
            int actual   = ratings.Count;

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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"];
            }
        }