Beispiel #1
0
        public void DisposeFaculty_PassFacultyId()
        {
            int facultyId = 3;

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

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

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

            FacultyService facultyService = new FacultyService(unitOfWork, _mapper, _logger.Object);

            //Act
            facultyService.Dispose(facultyId);

            //Assert
            var emptyList = new List <Answer>()
            {
            };

            Assert.Equal(emptyList, unitOfWork.Answers.Find(e => e.Id == facultyId).ToList());
        }