Example #1
0
        public void GetFacultyIdByName_PassCorrectName()
        {
            var facultyName = "facultyNameCorrect";
            var facultyId   = 4;

            //Arrange
            using var context = new ApplicationDbContext(options);

            context.Faculties.Add(new Faculty {
                Id = facultyId, Title = facultyName
            });

            context.SaveChanges();
            var unitOfWork = new EFUnitOfWork(context);

            FacultyService facultyService = new FacultyService(unitOfWork, _mapper, _logger.Object);
            //Act
            int result = facultyService.GetFacultyIdByName(facultyName);

            //Assert
            Assert.Equal(facultyId, result);
        }