Exemplo n.º 1
0
        public App(string dbPath)
        {
            InitializeComponent();
            FlowListView.Init();

            var navPage = new NavigationPage(new LandingPage());

            navPage.BarBackgroundColor = Color.Transparent;
            navPage.BarTextColor       = Color.White;

            MainPage = navPage;

            FavRepo        = new FavRepository(dbPath);
            VoteRepo       = new VoteRepo(dbPath);
            LoggedInClubId = 0;
        }
Exemplo n.º 2
0
        public void When_create_campaign_and_and_projects_in_campaign_and_add_some_votes_then_return_back_count_of_projects_and_count_of_project_votes()
        {
            var campaign = new CampaignRepoTests().CreateCampaign();
            var project1 = CreateProject(campaign.Id);
            var project2 = CreateProject(campaign.Id);
            var project3 = CreateProject(campaign.Id);

            var voteRepo = new VoteRepo(GetDbOptions());

            voteRepo.Add(new Vote()
            {
                UserId         = "ppppffpfp",
                VotingDateTime = DateTime.Today.AddDays(-5),
                SocialName     = "facebook",
                ProjectId      = project1.Id
            });

            voteRepo.Add(new Vote()
            {
                UserId         = "ppppfp",
                VotingDateTime = DateTime.Today.AddDays(-15),
                SocialName     = "facebook",
                ProjectId      = project2.Id
            });

            voteRepo.Add(new Vote()
            {
                UserId         = "pppd",
                VotingDateTime = DateTime.Today.AddDays(-3),
                SocialName     = "facebook",
                ProjectId      = project2.Id
            });

            var report = repo.GetProjectsReport(campaign.Id);

            Assert.Equal(3, report.Count);
            Assert.Equal(project1.Id, report[0].Project.Id);
            Assert.Equal(project2.Id, report[1].Project.Id);
            Assert.Equal(project3.Id, report[2].Project.Id);

            Assert.Equal(1, report[0].Votes);
            Assert.Equal(2, report[1].Votes);
            Assert.Equal(0, report[2].Votes);
        }
Exemplo n.º 3
0
 public VoteList(VoteRepo repo)
 {
     this.repo = repo;
 }
Exemplo n.º 4
0
 public VoteRepoTests()
 {
     this.repo = new VoteRepo(GetDbOptions());
 }