Пример #1
0
        public void Create_TeacherWithData_NewTeacher()
        {
            var newTeacher = new DataPlus.Entities.Models.Teacher
            {
                Id             = Guid.NewGuid(),
                DocumentNumber = "5555555",
                FirstName      = "Jose",
                LastName       = "Santos",
                Email          = "*****@*****.**",
                Address        = "Street 5",
                City           = "City 2",
                DocumentType   = EDocumentType.CC,
                PhoneNumber    = "722222",
                Birth          = new DateTime(1965, 5, 5)
            };

            var repositoryWrapper = new Mock <IWrapperRepository>();

            repositoryWrapper.Setup(x => x.Teacher.GetAll()).Returns(_teacherList.AsQueryable);

            var teacherService   = new TeacherService(repositoryWrapper.Object, _logger);
            var numberOfTeachers = teacherService.GetAll().Count;

            teacherService.Create(newTeacher);
        }
Пример #2
0
        public void Create_EmptyTeacher_Exception()
        {
            var newTeacher        = new DataPlus.Entities.Models.Teacher();
            var repositoryWrapper = new Mock <IWrapperRepository>();
            var teacherService    = new TeacherService(repositoryWrapper.Object, _logger);

            Assert.Throws <NullReferenceException>(() => teacherService.Create(newTeacher));
        }