public void Setup()
 {
     _tokenService          = Substitute.For <ITokenService>();
     _pollRepository        = Substitute.For <IPollRepository>();
     _pollOptionRepository  = Substitute.For <IPollOptionRepository>();
     _pollBuilderController = new PollBuilderController(_tokenService, _pollRepository, _pollOptionRepository);
 }
 public GetAllPollsQueryHandler(
     IMapper mapper,
     IPollRepository pollRepository)
 {
     _mapper         = mapper;
     _pollRepository = pollRepository;
 }
        public async Task <PollPayload> CreatePoll(
            PollInput poll,
            [Service] IPollService pollService,
            [Service] IPollRepository pollRepository,
            [Service] IUserRepository userRepository,
            [Service] PollContext pollContext,
            [Service] IHttpContextAccessor httpContextAccessor)
        {
            Result <Model.Poll> createdPoll = await pollService.CreatePoll(pollContext, pollRepository, userRepository, new NewPollDto
            {
                AuthorId       = httpContextAccessor.UserId(),
                GuestNicknames = poll.Guests.ToArray(),
                Proposals      = poll.Proposals.ToArray(),
                Question       = poll.Question
            });

            return(createdPoll.ToGraphQL(
                       () => new PollPayload(),
                       (p, e) => p.Errors = e,
                       p => new Poll
            {
                PollId = p.PollId,
                Question = p.Question
            },
                       (payload, poll) => payload.Poll = poll));
        }
Beispiel #4
0
 public CreatePollUseCase(IPollRepository repository, IOpenConferenceRepository openConferenceRepository,
                          IMediator mediator)
 {
     _repository = repository;
     _openConferenceRepository = openConferenceRepository;
     _mediator = mediator;
 }
 public PollService(
     IMapper mapper,
     IPollRepository pollRepository)
 {
     _mapper         = mapper;
     _pollRepository = pollRepository;
 }
Beispiel #6
0
        public async Task create_poll()
        {
            IUnitOfWork unitOfWork = Substitute.For <IUnitOfWork>();

            IPollRepository pollRepository = Substitute.For <IPollRepository>();

            pollRepository.Create(Arg.Any <Poll>()).Returns(Task.FromResult(Result.CreateSuccess()));

            IUserRepository userRepository = Substitute.For <IUserRepository>();

            userRepository.Create(Arg.Any <User>()).Returns(Task.FromResult(Result.CreateSuccess()));
            User user = new User(1234, "*****@*****.**", "toto", "passwordhash", false);

            userRepository.FindById(Arg.Any <int>()).Returns(Task.FromResult(Result.CreateSuccess(user)));
            userRepository.FindByNickname(Arg.Any <string>()).Returns(Task.FromResult(Result.CreateSuccess(user)));

            NewPollDto newPollDto = new NewPollDto();

            newPollDto.AuthorId       = 1234;
            newPollDto.Question       = "Question?";
            newPollDto.GuestNicknames = new string[] { "Guest1" };
            newPollDto.Proposals      = new string[] { "P1", "P2" };
            PollService sut = new PollService();

            Result <Poll> poll = await sut.CreatePoll(unitOfWork, pollRepository, userRepository, newPollDto);

            poll.IsSuccess.Should().BeTrue();
        }
 public UpdatePollCommandHandler(
     IMapper mapper,
     IPollRepository pollRepository)
 {
     _mapper         = mapper;
     _pollRepository = pollRepository;
 }
 public SynchronizedPollResultProvider(IPollRepository repository, IMediator mediator,
                                       IParticipantPermissions participantPermissions)
 {
     _repository             = repository;
     _mediator               = mediator;
     _participantPermissions = participantPermissions;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="membershipRepository"> </param>
 /// <param name="settingsRepository"> </param>
 /// <param name="emailService"> </param>
 /// <param name="localizationService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="privateMessageService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="topicNotificationService"> </param>
 /// <param name="voteService"> </param>
 /// <param name="badgeService"> </param>
 /// <param name="categoryNotificationService"> </param>
 /// <param name="loggingService"></param>
 /// <param name="uploadedFileService"></param>
 /// <param name="postRepository"></param>
 /// <param name="pollVoteRepository"></param>
 /// <param name="pollAnswerRepository"></param>
 /// <param name="pollRepository"></param>
 /// <param name="topicRepository"></param>
 /// <param name="favouriteRepository"></param>
 /// <param name="categoryService"></param>
 public MembershipService(IMembershipRepository membershipRepository, ISettingsRepository settingsRepository,
     IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
     IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
     ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
     ICategoryNotificationService categoryNotificationService, ILoggingService loggingService, IUploadedFileService uploadedFileService,
     IPostRepository postRepository, IPollVoteRepository pollVoteRepository, IPollAnswerRepository pollAnswerRepository,
     IPollRepository pollRepository, ITopicRepository topicRepository, IFavouriteRepository favouriteRepository,
     ICategoryService categoryService)
 {
     _membershipRepository = membershipRepository;
     _settingsRepository = settingsRepository;
     _emailService = emailService;
     _localizationService = localizationService;
     _activityService = activityService;
     _privateMessageService = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService = topicNotificationService;
     _voteService = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _loggingService = loggingService;
     _uploadedFileService = uploadedFileService;
     _postRepository = postRepository;
     _pollVoteRepository = pollVoteRepository;
     _pollAnswerRepository = pollAnswerRepository;
     _pollRepository = pollRepository;
     _topicRepository = topicRepository;
     _favouriteRepository = favouriteRepository;
     _categoryService = categoryService;
 }
Beispiel #10
0
        public async Task <PollPayload> Poll(
            [Service] IPollService pollService,
            [Service] IPollRepository pollRepository,
            [Service] IHttpContextAccessor httpContextAccessor,
            int pollId)
        {
            int authorId             = httpContextAccessor.UserId();
            Result <Model.Poll> poll = await pollService.FindByIdForAuthor(pollRepository, authorId, pollId);

            return(poll.ToGraphQL(
                       () => new PollPayload(),
                       (p, e) => p.Errors = e,
                       p => new Poll
            {
                PollId = p.PollId,
                Question = p.Question,
                Answers = p.Proposals.Select(proposal => new Answer
                {
                    AnswerId = proposal.ProposalId,
                    Text = proposal.Text,
                    VotesCount = proposal.Voters.Count
                }),
                GuestCount = p.Guests.Count
            },
                       (p, poll) => p.Poll = poll));
        }
Beispiel #11
0
        public VotesController(IPollRepository PollRepository, IUserIdentityService UserIdentityService,
            IUserRepository UserRepository, IVoteRepository VoteRepository, ICategoryRepository CategoryRepository)
        {
            if (PollRepository == null)
            {
                throw new ArgumentNullException("CategoryRepository");
            }

            if (UserIdentityService == null)
            {
                throw new ArgumentNullException("UserIdentityService");
            }

            if (UserRepository == null)
            {
                throw new ArgumentNullException("UserIdentityService");
            }

            if (VoteRepository == null)
            {
                throw new ArgumentNullException("VoteRepository");
            }

            if (CategoryRepository == null)
            {
                throw new ArgumentNullException("CategoryRepository");
            }

            this.pollRepository = PollRepository;
            this.userService = UserIdentityService;
            this.userRepository = UserRepository;
            this.voteRepository = VoteRepository;
            this.categoryRepository = CategoryRepository;
        }
Beispiel #12
0
 public PollService(IPollRepository pollRepository, IOptionService optionService, IPollOptionService pollOptionService)
     : base(pollRepository)
 {
     _pollRepository    = pollRepository;
     _optionService     = optionService;
     _pollOptionService = pollOptionService;
 }
Beispiel #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="membershipRepository"> </param>
 /// <param name="settingsRepository"> </param>
 /// <param name="emailService"> </param>
 /// <param name="localizationService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="privateMessageService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="topicNotificationService"> </param>
 /// <param name="voteService"> </param>
 /// <param name="badgeService"> </param>
 /// <param name="categoryNotificationService"> </param>
 /// <param name="loggingService"></param>
 /// <param name="uploadedFileService"></param>
 /// <param name="postRepository"></param>
 /// <param name="pollVoteRepository"></param>
 /// <param name="pollAnswerRepository"></param>
 /// <param name="pollRepository"></param>
 /// <param name="topicRepository"></param>
 /// <param name="favouriteRepository"></param>
 /// <param name="categoryService"></param>
 public MembershipService(IMembershipRepository membershipRepository, ISettingsRepository settingsRepository,
                          IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
                          IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
                          ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
                          ICategoryNotificationService categoryNotificationService, ILoggingService loggingService, IUploadedFileService uploadedFileService,
                          IPostRepository postRepository, IPollVoteRepository pollVoteRepository, IPollAnswerRepository pollAnswerRepository,
                          IPollRepository pollRepository, ITopicRepository topicRepository, IFavouriteRepository favouriteRepository,
                          ICategoryService categoryService)
 {
     _membershipRepository        = membershipRepository;
     _settingsRepository          = settingsRepository;
     _emailService                = emailService;
     _localizationService         = localizationService;
     _activityService             = activityService;
     _privateMessageService       = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService    = topicNotificationService;
     _voteService  = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _loggingService       = loggingService;
     _uploadedFileService  = uploadedFileService;
     _postRepository       = postRepository;
     _pollVoteRepository   = pollVoteRepository;
     _pollAnswerRepository = pollAnswerRepository;
     _pollRepository       = pollRepository;
     _topicRepository      = topicRepository;
     _favouriteRepository  = favouriteRepository;
     _categoryService      = categoryService;
 }
 public StatsService(IOccasionRepository occasionRepository, IPollRepository pollRepository, ITelegramClient telegramClient, IPollAnswerRepository pollAnswerRepository)
 {
     _occasionRepository   = occasionRepository;
     _pollRepository       = pollRepository;
     _telegramClient       = telegramClient;
     _pollAnswerRepository = pollAnswerRepository;
 }
        public PollsApiController(IPollRepository PollRepository, ICategoryRepository CategoryRepository,  IFrequencyRepository FrequencyRepository, IUserIdentityService UserIdentityService, IUserRepository UserRepository)
        {
            if (PollRepository == null)
            {
                throw new ArgumentNullException("CategoryRepository");
            }

            if (CategoryRepository == null)
            {
                throw new ArgumentNullException("CategoryRepository");
            }

            if (FrequencyRepository == null)
            {
                throw new ArgumentNullException("CategoryRepository");
            }

            if (UserIdentityService == null)
            {
                throw new ArgumentNullException("UserIdentityService");
            }

            if (UserRepository == null)
            {
                throw new ArgumentNullException("UserIdentityService");
            }

            this.pollRepository = PollRepository;
            this.categoryRepository = CategoryRepository;
            this.frequencyRepository = FrequencyRepository;
            this.userService = UserIdentityService;
            this.userRepository = UserRepository;
        }
 public UserInterface(IUserRepository userRepository, IContextRegistration contextRegistration,
                      IPollRepository pollRepository, IPolicyChecker policyChecker)
 {
     _userRepository      = userRepository;
     _contextRegistration = contextRegistration;
     _pollRepos           = pollRepository;
     _policyChecker       = policyChecker;
 }
 public PollBuilderController(ITokenService tokenService, IPollRepository pollRepository,
                              IPollOptionRepository pollOptionRepository, IRequestHeaderHandler requestHeaderHandler)
 {
     _tokenService         = tokenService;
     _pollRepository       = pollRepository;
     _pollOptionRepository = pollOptionRepository;
     _requestHeaderHandler = requestHeaderHandler;
 }
 public PollService(
     IMapper mapper,
     IRequestData requestData,
     IPollRepository pollRepository)
     : base(mapper, requestData)
 {
     this.pollRepository = pollRepository;
 }
Beispiel #19
0
 public PollRendererController(IPollRepository pollRepository, IPollOptionRepository pollOptionRepository,
                               IVoteRepository voteRepository, IRequestHeaderHandler requestHeaderHandler)
 {
     _pollRepository       = pollRepository;
     _pollOptionRepository = pollOptionRepository;
     _voteRepository       = voteRepository;
     _requestHeaderHandler = requestHeaderHandler;
 }
 public PollController(ILogger <PollController> logger, IPollRepository pollRepository,
                       IPollStatsRepository pollStatsRepository, IPollOptionsRepository pollOptionsRepository)
 {
     _logger                = logger;
     _pollRepository        = pollRepository;
     _pollStatsRepository   = pollStatsRepository;
     _pollOptionsRepository = pollOptionsRepository;
 }
Beispiel #21
0
 public HomeController(ILogger <HomeController> logger, IPollRepository pollRepo, SignInManager <OnlinePollingSystem.Models.ApplicationUser> SignInManager, UserManager <OnlinePollingSystem.Models.ApplicationUser> UserManager, ApplicationDbContext context)
 {
     _logger            = logger;
     _pollRepo          = pollRepo;
     this.SignInManager = SignInManager;
     this.UserManager   = UserManager;
     this.context       = context;
 }
 public PollReadService(IConnectionFactory connectionFactory,
                        IPollRepository pollRepository,
                        IPollOptionRepository pollOptionRepository)
 {
     _connectionFactory    = connectionFactory;
     _pollRepository       = pollRepository;
     _pollOptionRepository = pollOptionRepository;
 }
 public PollController(IPollRepository pollRepository,
                       IMapper mapper,
                       IPollService pollService,
                       INotificador notificador) : base(notificador)
 {
     _pollRepository = pollRepository;
     _mapper         = mapper;
     _pollService    = pollService;
 }
 /// <summary>
 /// default constructor
 /// </summary>
 /// <param name="pollRepository"></param>
 /// <param name="userManager"></param>
 /// <param name="authorizeService"></param>
 public PollController(
     IPollRepository pollRepository,
     UserManager <ApplicationUser> userManager,
     IAuthorizeService authorizeService) : base(authorizeService)
 {
     _pollRepository   = pollRepository;
     _authorizeService = authorizeService;
     _userManager      = userManager;
 }
 public void Setup()
 {
     _tokenService          = Substitute.For <ITokenService>();
     _pollRepository        = Substitute.For <IPollRepository>();
     _pollOptionRepository  = Substitute.For <IPollOptionRepository>();
     _requestHeaderHandler  = Substitute.For <IRequestHeaderHandler>();
     _pollBuilderController = new PollBuilderController(_tokenService, _pollRepository,
                                                        _pollOptionRepository, _requestHeaderHandler);
 }
 public void Setup()
 {
     primaryKey              = 123;
     _pollRepository         = Substitute.For <IPollRepository>();
     _pollOptionRepository   = Substitute.For <IPollOptionRepository>();
     _pollRendererController = new PollRenderer(_pollRepository, _pollOptionRepository);
     _pollRepository.Select(Arg.Any <string>()).Returns(new PollRenderViewModel());
     _pollRepository.SelectPollPk(Arg.Any <string>()).Returns(primaryKey);
     _pollOptionRepository.Select(Arg.Any <int>()).Returns(new List <PollOptionDTO>());
 }
 public VoteService(
     IVoteRepository voteRepository,
     IPollRepository pollRepository,
     IContextRegistration contextRegistration
     )
 {
     _pollRepos           = pollRepository;
     _voteRepos           = voteRepository;
     _contextRegistration = contextRegistration;
 }
 public UserInterface(IUserRepository userRepository, IAuthorizationContext authorizationContext,
                      IPollRepository pollRepository, IPolicyChecker policyChecker,
                      IPollService pollService)
 {
     _userRepository       = userRepository;
     _authorizationContext = authorizationContext;
     _pollRepos            = pollRepository;
     _policyChecker        = policyChecker;
     _pollService          = pollService;
 }
 public PollController(
     IPollRepository pollRepository,
     IMapper mapper,
     IFLikeContext context
     )
 {
     _pollRepository = pollRepository;
     _mapper         = mapper;
     _context        = context;
 }
Beispiel #30
0
        public async Task <Result> DeleteGuest(IPollRepository pollRepository, int guestId, int pollId)
        {
            Result <Poll> poll = await pollRepository.FindById(pollId);

            if (!poll.IsSuccess)
            {
                return(poll);
            }
            return(poll.Value.RemoveGuest(guestId));
        }
 public PollService(IAuthorizationContext contextRegistration,
                    IPollRepository pollRepository, IManagePolicy managePolicy,
                    IVoteService voteService, IPolicyChecker policyChecker, IVoteRepository voteRepository)
 {
     _voteRepos           = voteRepository;
     _managePolicy        = managePolicy;
     _pollRepos           = pollRepository;
     _voteService         = voteService;
     _policyChecker       = policyChecker;
     _contextRegistration = contextRegistration;
 }
 public AuxiliaryController(IPollRepository pollRepository, IQuizRepository quizRepository, IGroupManager groupManager,
                            IUserManager userManager, IGroupRepository groupRepository, IFileRepository fileRepository, IUserRepository userRepository)
 {
     _pollRepository  = pollRepository;
     _quizRepository  = quizRepository;
     _userManager     = userManager;
     _groupRepository = groupRepository;
     _fileRepository  = fileRepository;
     _groupManager    = groupManager;
     _userRepository  = userRepository;
 }
Beispiel #33
0
 public DeletePersonalDataModel(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     ILogger <DeletePersonalDataModel> logger,
     IPollRepository prepo)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = logger;
     _pollRepo      = prepo;
 }
Beispiel #34
0
 public HomeController(IPollRepository r)
 {
 }
Beispiel #35
0
 public PollController()
 {
     pollRepository = new PollRepository(new PollContext());
     voteRepository = new VoteRepository(pollRepository.Context());
     userRepository = new UserRepository(new UserContext());
 }
Beispiel #36
0
 public AccountController(IPollRepository r)
 {
 }
Beispiel #37
0
 public HomeController()
 {
     pollRepository = new PollRepository(new PollContext());
 }
Beispiel #38
0
 public HomeController(IPollRepository pollRepository)
 {
     this.pollRepository = pollRepository;
 }
Beispiel #39
0
 public PollService()
 {
     PollRepository = RepositoryFactory.GetPollRepository();
 }
Beispiel #40
0
 public PollService(IPollRepository pollRepository)
 {
     _pollRepository = pollRepository;
 }
 public PollValuesController()
 {
     pollRepository = new PollRepository(new PollContext());
 }
Beispiel #42
0
 public PollsController(IPollRepository r)
 {
     repository = r;
 }
 protected override void BeforeEachTest()
 {
     base.BeforeEachTest();
     _repository = IoC.GetInstance<IPollRepository>();
 }
Beispiel #44
0
 public SitemapService()
 {
     BlogRepository = RepositoryFactory.GetBlogRepository();
     PollRepository = RepositoryFactory.GetPollRepository();
 }
 public PollController(IPollRepository repository) 
 {
     this.repository = repository;
 }