public void Set_Model_AvailableSubjects_Property_Correctly()
        {
            var mockedView = new Mock <IAssignSubjectsToClassOfStudentsView>();
            var mockedClassOfStudentManagementService = new Mock <IClassOfStudentsManagementService>();
            var mockedSubjectManagementService        = new Mock <ISubjectManagementService>();

            var model = new AssignSubjectsToClassOfStudentsModel();
            var args  = new GetAvailableSubjectsForTheClassEventArgs();

            var expected = new List <SubjectBasicInfoModel>();

            mockedView.SetupGet(x => x.Model).Returns(model);
            mockedSubjectManagementService
            .Setup(x => x.GetSubjectsNotYetAssignedToTheClass(It.IsAny <int>()))
            .Returns(expected);

            var presenter = new AssignSubjectsToClassOfStudentsPresenter(
                mockedView.Object,
                mockedClassOfStudentManagementService.Object,
                mockedSubjectManagementService.Object);

            mockedView.Raise(x => x.EventGetAvailableSubjectsForTheClass += null, args);

            CollectionAssert.AreEquivalent(expected, mockedView.Object.Model.AvailableSubjects);
        }
Example #2
0
 private void View_EventGetAvailableSubjectsForTheClass(object sender, GetAvailableSubjectsForTheClassEventArgs e)
 {
     this.View.Model.AvailableSubjects =
         this.subjectManagementService.GetSubjectsNotYetAssignedToTheClass(e.ClassOfStudentsId);
 }