Пример #1
0
        public void TestAddMark_ShouldCallUnitOfWorkCommit()
        {
            // Arrange
            var mockedRepository = new Mock <IRepository <Student> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();

            var service = new StudentService(mockedRepository.Object, mockedUnitOfWork.Object);

            var student = new Student("Foo", "Bar", Grade.Eighth);
            var mark    = new Mark(Subject.Bulgarian, 3);

            // Act
            service.AddMark(student, mark);

            // Assert
            mockedUnitOfWork.Verify(u => u.Commit(), Times.Once);
        }
 public ActionResult EstimateStudents(CourseViewModel model)
 {
     ss.AddMark(model.CourseName, model.Journal.ToDictionary((m => m.StudentName), m => m.Mark));
     return(RedirectToAction("CourseJournal"));
 }