Пример #1
0
 public VotingFinisher(IVotingCandidateRepository votingCandidateRepository, ISongRepository songRepository, ICurrentSongService currentSongService, IVotingCandidateService votingCandidateService, ILogger logger)
 {
     _votingCandidateRepository = votingCandidateRepository;
     _songRepository            = songRepository;
     _currentSongService        = currentSongService;
     _votingCandidateService    = votingCandidateService;
     _logger = logger;
 }
Пример #2
0
 public VotingController(IVotingCandidateRepository votingCandidateRepository, IUnitOfWork unitOfWork, IPrimitiveUserIdentificationService primitiveUserIdentificationService, IVoteService voteService, IMessageQueueService messageQueueService, IMapper mapper)
 {
     _votingCandidateRepository = votingCandidateRepository;
     _unitOfWork = unitOfWork;
     _primitiveUserIdentificationService = primitiveUserIdentificationService;
     _voteService         = voteService;
     _messageQueueService = messageQueueService;
     _mapper = mapper;
 }
Пример #3
0
        public void Setup()
        {
            _votingCandidateRepository = Substitute.For <IVotingCandidateRepository>();
            _songRepository            = Substitute.For <ISongRepository>();
            _currentSongService        = Substitute.For <ICurrentSongService>();
            _votingCandidateService    = Substitute.For <IVotingCandidateService>();
            _logger = Substitute.For <ILogger>();

            _votingFinisher = new VotingFinisher(_votingCandidateRepository, _songRepository, _currentSongService, _votingCandidateService, _logger);
        }
        private static void CreateAndAddVotingCandidate(int number, int numberOfVotes, IVotingCandidateRepository votingCandidateRepository, IVoteRepository voteRepository, ISongRepository songRepository)
        {
            var song = songRepository.Create();

            song.Title             = "SongRepositoryTests" + number;
            song.DurationInSeconds = 120;
            song.FileName          = "SongRepositoryTests.mp3";

            songRepository.Add(song);

            var votingCandidate = votingCandidateRepository.Create();

            votingCandidate.SongId       = song.Id;
            votingCandidate.Song         = song;
            votingCandidate.DisplayOrder = number;

            votingCandidateRepository.Add(votingCandidate);

            foreach (var index in Enumerable.Range(0, numberOfVotes))
            {
                var vote = voteRepository.Create();
                vote.VotingCandidateId = votingCandidate.Id;
                vote.VotingCandidate   = votingCandidate;
                vote.UserIdentifier    = Guid.NewGuid();

                voteRepository.Add(vote);
            }
        }
Пример #5
0
        public void Setup()
        {
            _votingCandidateRepository = Substitute.For <IVotingCandidateRepository>();

            _votingCandidateService = new VotingCandidateService(_votingCandidateRepository);
        }
Пример #6
0
 public VotingCandidateService(IVotingCandidateRepository votingCandidateRepository)
 {
     _votingCandidateRepository = votingCandidateRepository;
 }