static void Main(string[] args) { var parser = new CommandLineParser(new FluentCommandLineParser()); parser.Parse(args); var inquisitor = new GithubInquisitor("erikdietrich", Environment.GetEnvironmentVariable("GithubPass", EnvironmentVariableTarget.User)); var searcher = new ProfileSearcher(inquisitor); var evaluator = new ProfileEvaluator(); var candidates = searcher.GetProfilesForLocationByTechnology(parser.Location, parser.Language); foreach (var candidate in candidates) { WriteLine($"Candidate is named {candidate.FirstName} {candidate.LastName} and email address is {candidate.EmailAddress}"); foreach (var repo in candidate.Repos) { WriteLine($"\tRepository named {repo.Name} can be downloaded at {repo.DownloadUrl}."); } var wordToUse = evaluator.IsProfileAMatch(candidate) ? "is" : " is not"; WriteLine($"Candidate {wordToUse} a match."); } ReadLine(); }
public void Dispose_Of_The_Http_Client() { var target = new GithubInquisitor(); target.Dispose(); ExtendedAssert.Throws(() => target.Client.CancelPendingRequests()); }
public void WhenIDoARepoSearchForUserErikdietrich(string githubUserId) { var inquisitor = new GithubInquisitor("erikdietrich", Environment.GetEnvironmentVariable("GithubPass", EnvironmentVariableTarget.User)); var searcher = new ProfileSearcher(inquisitor); var repos = searcher.GetReposForUser(githubUserId); SetInContext(repos); }
public void WhenISupplyLocation(string locationText) { var inquisitor = new GithubInquisitor("erikdietrich", Environment.GetEnvironmentVariable("GithubPass", EnvironmentVariableTarget.User)); var searcher = new ProfileSearcher(inquisitor); var profiles = searcher.GetProfilesForLocation(locationText); ScenarioContext.Current.Set(profiles); }
public HomeController(PasswordRetriever retriever, IProfileSearcher searcher = null) { if (searcher == null) { var githubPassword = retriever.GetPassword("GithubPass"); var inquisitor = new GithubInquisitor("erikdietrich", githubPassword); _searcher = new ProfileSearcher(inquisitor); } else _searcher = searcher; }
public HomeController(PasswordRetriever retriever, IProfileSearcher searcher = null) { if (searcher == null) { var githubPassword = retriever.GetPassword("GithubPass"); var inquisitor = new GithubInquisitor("erikdietrich", githubPassword); _searcher = new ProfileSearcher(inquisitor); } else { _searcher = searcher; } }
public void Default_To_An_HttpClient_With_An_AuthorizationRequest_Header_Matching_Username_And_Password() { const string username = "******"; const string password = "******"; Target = new GithubInquisitor(username, password); var expectedHeaderValue = string.Format("Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", username, password)))); var allMatchingHeaderValue = TargetHeaders.First(rh => rh.Key == HttpRequestHeader.Authorization.ToString()).Value; var concatenatedValuesForHeader = allMatchingHeaderValue.Aggregate((i, j) => string.Format("{0} {1}", i, j)); Assert.AreEqual<string>(expectedHeaderValue, concatenatedValuesForHeader); //Assert.IsTrue(TargetHeaders.Any(rh => rh.Value == expectedHeaderValue)); }
public void Default_To_An_HttpClient_With_An_AuthorizationRequest_Header_Matching_Username_And_Password() { const string username = "******"; const string password = "******"; Target = new GithubInquisitor(username, password); var expectedHeaderValue = string.Format("Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", username, password)))); var allMatchingHeaderValue = TargetHeaders.First(rh => rh.Key == HttpRequestHeader.Authorization.ToString()).Value; var concatenatedValuesForHeader = allMatchingHeaderValue.Aggregate((i, j) => string.Format("{0} {1}", i, j)); Assert.AreEqual <string>(expectedHeaderValue, concatenatedValuesForHeader); //Assert.IsTrue(TargetHeaders.Any(rh => rh.Value == expectedHeaderValue)); }
public void BeforeEachTest() { Target = new GithubInquisitor(); }
public void WhenISearchAnd(string location, string language) { var inquisitor = new GithubInquisitor("erikdietrich", Environment.GetEnvironmentVariable("GithubPass", EnvironmentVariableTarget.User)); var searcher = new ProfileSearcher(inquisitor); ReturnedProfiles = searcher.GetProfilesForLocationByTechnology(location, language); }