예제 #1
0
        public void AddLector_Lector_MethodWasCalled()
        {
            var lector          = new Lector();
            var mockConfig      = new MockConfig("");
            var mockLogger      = new MockLogger();
            var studentsDalStab = new Mock <IStudentsDal>();
            var lectorsDalStab  = new Mock <ILectorsDal>();
            var lectionsDalStab = new Mock <ILectionsDal>();
            var journalDalStab  = new Mock <IStudentsAndLectionsDal>();
            var logic           = new LearningBL(mockConfig, mockLogger, studentsDalStab.Object, journalDalStab.Object, lectionsDalStab.Object, lectorsDalStab.Object);

            lectorsDalStab.Setup(s => s.InsertLector(lector)).Verifiable();
            logic.AddLector(lector);
            lectorsDalStab.Verify(c => c.InsertLector(lector), Times.Once);
        }
예제 #2
0
        public void AddStudent_Student_MethodWasCalled()
        {
            var student         = new Student(new StudentId(1), "test", "student", 0, 0, "222222", "*****@*****.**");
            var mockConfig      = new MockConfig("");
            var mockLogger      = new MockLogger();
            var studentsDalStab = new Mock <IStudentsDal>();
            var lectorsDalStab  = new Mock <ILectorsDal>();
            var lectionsDalStab = new Mock <ILectionsDal>();
            var journalDalStab  = new Mock <IStudentsAndLectionsDal>();
            var logic           = new LearningBL(mockConfig, mockLogger, studentsDalStab.Object, journalDalStab.Object, lectionsDalStab.Object, lectorsDalStab.Object);

            studentsDalStab.Setup(s => s.InsertStudent(student)).Verifiable();
            logic.AddStudent(student);
            studentsDalStab.Verify(c => c.InsertStudent(student), Times.Once);
        }