示例#1
0
        public void Initialize()
        {
            Commentary = new Commentary()
            {
                Id = new Guid(), User = null, Video = null, Content = "Olololo"
            };

            _mockUnitofwork = Substitute.For <IUnitOfWork>();

            _mockUserRepository = Substitute.For <IUserRepository>();
            _mockUserRepository.GetUserById(Arg.Any <string>()).Returns(Task.FromResult(new User()
            {
            }));


            _mockVideoRepository = Substitute.For <IVideoRepository>();
            _mockVideoRepository.GetVideoById(Arg.Any <Guid>()).Returns(Task.FromResult(new Video {
            }));

            _mockCommentaryRepository = Substitute.For <ICommentaryRepository>();
            _mockCommentaryRepository.GetCommentaryById(Arg.Any <Guid>()).Returns(Task.FromResult(Commentary));
            _mockCommentaryRepository.GetCommentariesByVideoId(Arg.Any <Guid>()).Returns(Task.FromResult(new Commentary[] { Commentary } as IEnumerable <Commentary>));

            _mockUnitofwork.VideoRepository.Returns(_mockVideoRepository);
            _mockUnitofwork.UserRepository.Returns(_mockUserRepository);
            _mockUnitofwork.CommentaryRepository.Returns(_mockCommentaryRepository);

            _mapper = new MapperConfiguration(opt =>
            {
                opt.AddProfiles(new Profile[] { new MapperService(null) });
            }).CreateMapper();
        }
示例#2
0
 public UserService(IUserRepository userRepository, IFilmRepository filmRepository,
                    ICommentaryRepository commentaryRepository, IReviewRepository reviewRepository)
 {
     this.userRepository       = userRepository;
     this.filmRepository       = filmRepository;
     this.commentaryRepository = commentaryRepository;
     this.reviewRepository     = reviewRepository;
 }
 public CommentariesForVerseFactory(
     IChapterRepository chapterRepository,
     ICommentatorRepository commentatorRepository,
     ICommentaryRepository commentaryRepository)
 {
     ChapterRepository     = chapterRepository;
     CommentatorRepository = commentatorRepository;
     CommentaryRepository  = commentaryRepository;
 }
示例#4
0
 public VerseCommentaryController(
     ICommentatorRepository commentatorRepository,
     ICommentaryRepository commentaryRepository,
     ICommentariesForVerseFactory commentariesForVerseFactory,
     ISelectChapterAndVerseFactory selectChapterAndVerseFactory)
 {
     CommentatorRepository        = commentatorRepository;
     CommentaryRepository         = commentaryRepository;
     CommentariesForVerseFactory  = commentariesForVerseFactory;
     SelectChapterAndVerseFactory = selectChapterAndVerseFactory;
 }
 public SelectChapterAndVerseFactory(
     IChapterRepository chapterRepository,
     IVerseRepository verseRepository,
     ICommentaryRepository commentaryRepository)
 {
     ChapterRepository       = chapterRepository;
     VerseRepository         = verseRepository;
     CommentaryRepository    = commentaryRepository;
     ResultByCommentatorCode =
         new ConcurrentDictionary <string, SelectChapterAndVerse>(StringComparer.InvariantCultureIgnoreCase);
 }
示例#6
0
 public UnitOfWork(UserManager <User> userManager, RoleManager <UserRole> roleManager, DataBaseContext dataBaseContext,
                   IUserRepository userRepository, IVideoRepository videoRepository, ICommentaryRepository commentaryRepository,
                   IAppSwitchRepository appSwitchRepository)
 {
     UserManager          = userManager;
     _context             = dataBaseContext;
     RoleManager          = roleManager;
     UserRepository       = userRepository;
     VideoRepository      = videoRepository;
     CommentaryRepository = commentaryRepository;
     AppSwitchRepository  = appSwitchRepository;
 }
示例#7
0
 public CommentaryAppService(ICommentaryRepository commentaryRepository,
                             ILogged logged)
 {
     _commentaryRepository = commentaryRepository;
     _logged = logged;
 }