public void Set_Model_IsSuccesfull_Property_Correctly() { var mockedView = new Mock <ICreatingClassOfStudentsView>(); var mockedClassOfStudentsManagementService = new Mock <IClassOfStudentsManagementService>(); var mockedSubjectManagementService = new Mock <ISubjectManagementService>(); var model = new CreatingClassOfStudentsModel(); var args = new CreatingClassOfStudentsEventArgs(); var expected = true; mockedView.SetupGet(x => x.Model).Returns(model); mockedClassOfStudentsManagementService .Setup(x => x.AddClass(It.IsAny <string>(), It.IsAny <List <string> >())) .Returns(expected); var presenter = new CreatingClassOfStudentsPresenter( mockedView.Object, mockedClassOfStudentsManagementService.Object, mockedSubjectManagementService.Object); mockedView.Raise(x => x.EventCreateClassOfStudents += null, args); Assert.AreEqual(expected, mockedView.Object.Model.IsSuccesfull); }
public void Set_Model_Subjects_Property_Correctly() { var mockedView = new Mock <ICreatingClassOfStudentsView>(); var mockedClassOfStudentsManagementService = new Mock <IClassOfStudentsManagementService>(); var mockedSubjectManagementService = new Mock <ISubjectManagementService>(); var model = new CreatingClassOfStudentsModel(); var expected = new List <SubjectBasicInfoModel>(); mockedView.SetupGet(x => x.Model).Returns(model); mockedSubjectManagementService .Setup(x => x.GetAllSubjectsWithTeacher()) .Returns(expected); var presenter = new CreatingClassOfStudentsPresenter( mockedView.Object, mockedClassOfStudentsManagementService.Object, mockedSubjectManagementService.Object); mockedView.Raise(x => x.EventGetAllSubjects += null, EventArgs.Empty); CollectionAssert.AreEquivalent(expected, mockedView.Object.Model.Subjects); }