Esempio n. 1
0
        public void GetByKeyId( )
        {
            ReaderEntity readerEntity = new ReaderEntity( );

            Mock <IRepository <ReaderEntity> > mockRepository = new Mock <IRepository <ReaderEntity> >( );

            mockRepository
            .Setup((a) => a.FindByKeyId(It.IsAny <Guid>( )))
            .Returns(readerEntity);

            ReaderBusiness readerBusiness = new ReaderBusiness(mockRepository.Object, AutoMapperConfigTest.GetInstance( ));

            var result = readerBusiness.GetByKeyId(It.IsAny <Guid>( ));

            result.Should( ).BeOfType <ReaderModel>( );
        }
Esempio n. 2
0
        public void GetAll( )
        {
            List <ReaderEntity> readerEntities = new List <ReaderEntity>( );

            Mock <IRepository <ReaderEntity> > mockRepository = new Mock <IRepository <ReaderEntity> >( );

            mockRepository
            .Setup((a) => a.FindAll( ))
            .Returns(readerEntities);

            ReaderBusiness readerBusiness = new ReaderBusiness(mockRepository.Object, AutoMapperConfigTest.GetInstance( ));

            var result = readerBusiness.ListAll( );

            result.Should( ).BeOfType <List <ReaderModel> >( );
        }