Example #1
0
        public void TestingScore()
        {
            List <int> scores = new List <int> {
                33, 78, 42, 69, 50
            };

            Assert.AreEqual(SubmitAssignment.calcScore(scores), 272, "Calculation Error");
        }
Example #2
0
        public void TestcalcScoreWithNegatives()
        {
            //Test if Possible Score still calculates with a negative
            List <int> scores = new List <int> {
                -1, 89, 77, 32, 10
            };

            Assert.AreEqual(SubmitAssignment.calcScore(scores), 207, "Calculation Error - Negatives");
        }
Example #3
0
        public int getScore()
        {
            List <SubmitAssignment> arr = _context.SubmitAssignments.ToList();

            arr = arr.Where(x => x.CourseID == HttpContext.Session.GetInt32("CourseID")).ToList();
            arr = arr.Where(x => x.UserID == HttpContext.Session.GetInt32("UserID")).ToList();
            List <int> func = new List <int>();

            foreach (SubmitAssignment item in arr)
            {
                func.Add(item.Points);
            }
            return(SubmitAssignment.calcScore(func));
        }