[DataRow("test", 100)]                                 //garbage data
        public void TestRegisterAdd(string userId, int sectionId)
        {
            //get the user from the db
            var user = _dataAccess._context.ApplicationUser.Find(userId);
            //add the enrollment for the student

            Enrollment enrollment = new Enrollment()
            {
                SectionId = sectionId,
                StudentId = userId,
            };

            _dataAccess.AddEnrollment(enrollment);

            enrollment = _dataAccess._context.Enrollment.Find(enrollment);

            //verify that the enrollment was added properly
            Assert.IsNotNull(enrollment);
        }
Beispiel #2
0
        [DataRow("test", 100)]                                 //garbage data
        public void TestEnrollmentAdd(string userId, int sectionId)
        {
            //get the user from the db
            var user = _dataAccess._context.ApplicationUser.Find(userId);

            //add the enrollment for the student

            try
            {
                _dataAccess.AddEnrollment(user, sectionId);
            }
            catch (Exception e)
            {
            }


            Enrollment enrollment = _dataAccess._context.Enrollment.FirstOrDefault(e => e.SectionId == sectionId && e.StudentId == userId);

            //verify that the enrollment was added properly
            Assert.IsNotNull(enrollment);
        }