Example #1
0
        public void GetAllFaculties_ShouldReturnTrue()
        {
            //Arrange
            using var context = new ApplicationDbContext(options);

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

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

            FacultyService facultyService = new FacultyService(unitOfWork, _mapper, _logger.Object);
            //Act
            var result = facultyService.GetAll();

            //Assert
            Assert.NotEmpty(result);
            Assert.Equal(unitOfWork.Faculties.GetAll().Count(), result.Count());
            Assert.Equal(context.Faculties.First().Title, result.First().Title);
        }