コード例 #1
0
 public IEnumerable<GlimpseContributor> Get(string top = "")
 {
     string teamMemberJsonFile = HostingEnvironment.MapPath("~/Content/glimpseTeam.json");
     string githubKey = ConfigurationManager.AppSettings.Get("GithubKey");
     string githubSecret = ConfigurationManager.AppSettings.Get("GithubSecret");
     var httpClient = new HttpClientFactory().CreateHttpClient(githubKey, githubSecret);
     var contributorService = new ContributorService(new GlimpseTeamMemberRepository(teamMemberJsonFile),new GithubContributorService(httpClient));
     return contributorService.GetContributors().Take(string.IsNullOrEmpty(top) ? 11 : int.Parse(top));
 }
コード例 #2
0
 public ContributorServiceTests()
 {
     _githubContributorService = new Mock<IGithubContributerService>();
     _githubContributorService.Setup(g => g.GetContributors("glimpse/glimpse")).Returns(new[] {new GithubContributor() {Login = "******"}});
     _githubContributorService.Setup(g => g.GetContributors("glimpse/glimpse.client")).Returns(new[] {new GithubContributor() {Login = "******"}});
     string teamMemberJsonFile = Path.Combine(Environment.CurrentDirectory, "Contributors", "testTeamMembers.json");
     _contributorService = new ContributorService(new GlimpseTeamMemberRepository(teamMemberJsonFile), _githubContributorService.Object);
     _githubContributors = _contributorService.GetContributors().ToList();
 }