public void ReturnProperlyResult_When_InformationList_IsNotEmpty()
        {
            // Arange
            var entityList   = new List <Information>();
            var mockedEntity = new Mock <InformationTransitional>();

            var expected = new List <InformationTransitional>();

            expected.Add(mockedEntity.Object);

            var mockedMapper = new Mock <IAutoMapperService>();

            mockedMapper
            .Setup(x => x.Map <IEnumerable <InformationTransitional> >(It.IsAny <IEnumerable <Information> >()))
            .Returns(expected);

            var mockedEfDbContext     = new Mock <IEfDbContextSaveChanges>();
            var mockedIEfDbRepository = new Mock <IPhotoArtSystemEfDbRepository <Information> >();

            mockedIEfDbRepository.Setup(x => x.GetAll()).Returns(entityList.AsQueryable());

            var service = new InformationService(mockedMapper.Object, mockedEfDbContext.Object, mockedIEfDbRepository.Object);

            // Act
            var actual = service.GetAll();

            // Assert
            Assert.AreSame(expected[0], actual.ToList()[0]);
        }
        public void CallEfDbRepository_GetAll_MethodOnce()
        {
            // Arange
            var mockedMapper          = new Mock <IAutoMapperService>();
            var mockedEfDbContext     = new Mock <IEfDbContextSaveChanges>();
            var mockedIEfDbRepository = new Mock <IPhotoArtSystemEfDbRepository <Information> >();

            var service = new InformationService(mockedMapper.Object, mockedEfDbContext.Object, mockedIEfDbRepository.Object);

            // Act
            service.GetAll();

            // Assert
            mockedIEfDbRepository.Verify(x => x.GetAll(), Times.Once);
        }
 public async Task <IActionResult> GetAll()
 {
     return(Ok(await _informationService.GetAll()));
 }