public async Task <GitHubUser> FindUser(string criteria)
        {
            string uri = $"/users/{criteria}";

            HttpResponseMessage getUserCall = await _client.Get(uri);

            try
            {
                getUserCall.EnsureSuccessStatusCode();

                string rawUserResponse = await getUserCall.Content.ReadAsStringAsync();

                GitHubUser user = JsonConvert.DeserializeObject <GitHubUser>(rawUserResponse);

                List <GitHubRepository> repositories = await GetUserRepositories(criteria);

                user.Repositories = repositories;

                return(user);
            }
            catch (Exception exception)
            {
                switch (getUserCall.StatusCode)
                {
                case HttpStatusCode.NotFound:
                    throw new GitHubUserNotFoundException("GitHub user not found", exception);

                case HttpStatusCode.ServiceUnavailable:
                    throw new SearchFunctionalityNotAvailableException("Find functionality is not available at the minute", exception);

                default:
                    throw exception;
                }
            }
        }
예제 #2
0
        public T GetGitHubApiData <T>(string url)
        {
            object obj;
            Type   listType = typeof(T);

            if (listType == typeof(GitHubUser))
            {
                obj = new GitHubUser()
                {
                    AvatarUrl = "http://www.example.com",
                    Location  = "england",
                    UserName  = "******"
                };
            }
            else
            {
                var gitHubRepo = new GitHubRepo()
                {
                    RepositoryUrl   = "www.example.com",
                    RepositoryName  = "example",
                    StarGazersCount = 20
                };

                var listOfRepos = new List <GitHubRepo>();
                listOfRepos.Add(gitHubRepo);
                obj = listOfRepos;
            }

            return((T)obj);
        }
예제 #3
0
        public void ReturnsResult_To_View()
        {
            // Arrange
            GitHubUser actualResult = Builder <GitHubUser> .CreateNew()
                                      .With(x => x.GitHubRepositories = Builder <GitHubRepository> .CreateListOfSize(100).Build()).Build();

            _mockVcsService.Setup(x => x.GetUser(It.IsAny <string>())).Returns(actualResult);

            // Assign
            var result =
                _gitHubController.SearchUser(new GitHubProfileModel {
                UserName = actualResult.UserName
            }) as ViewResult;

            // Assert
            _mockVcsService.Verify(x => x.GetUser(It.IsAny <string>()), Times.Once);
            var model = result?.Model as GitHubProfileModel;

            if (model == null)
            {
                return;
            }
            model.UserName.Should().Be(actualResult.UserName);
            model.AvatarUrl.Should().Be(actualResult.AvatarUrl);
            model.Location.Should().Be(actualResult.Location);
            model.GitHubRepositories.ShouldAllBeEquivalentTo(actualResult.GitHubRepositories);
        }
        public void CanGetGitHubUserForExistingUser()
        {
            int expectedResultRepositoryItems = 4;

            User user = new User(avatarUrl: "/Content/img/UserNotExist.jpg", name: "Heniu", blog: "", collaborators: 0, email: "", createdAt: DateTime.Now, diskUsage: 0, bio: "", company: "", followers: 0, following: 0, hireable: null, htmlUrl: "", id: 0, ldapDistinguishedName: "", location: "Warszaw", login: "", url: "", ownedPrivateRepos: 0, permissions: null, plan: null, privateGists: 0, publicGists: 0, publicRepos: 0, siteAdmin: false, suspendedAt: null, totalPrivateRepos: 0);

            List <Repository> repositoryList = new List <Repository>();

            for (int i = 0; i < expectedResultRepositoryItems; i++)
            {
                repositoryList.Add(new Repository(url: "", gitUrl: "", allowMergeCommit: false, fork: false, forksCount: 0, fullName: "", hasDownloads: false, hasIssues: false, allowRebaseMerge: false, cloneUrl: "", createdAt: DateTime.Now, defaultBranch: "", hasWiki: false, allowSquashMerge: false, description: "", hasPages: false, homepage: "", htmlUrl: "", id: 0, language: "", mirrorUrl: "", name: "", openIssuesCount: 0, owner: null, parent: null, permissions: null, @private: false, pushedAt: DateTime.Now, size: 0, source: null, sshUrl: "", stargazersCount: 0, subscribersCount: 0, svnUrl: "", updatedAt: DateTime.Now));
            }

            GitHubAccount gitHubAccount = new GitHubAccount()
            {
                Repository = repositoryList,
                User       = user
            };

            PrivateObject privateObjectGetGitHubUser = new PrivateObject(_gitHub);
            GitHubUser    gitHubUser = (GitHubUser)privateObjectGetGitHubUser.Invoke("GetGitHubUser", gitHubAccount);

            CheckGitHubUser(new GitHubUserExpectedResults {
                Name = "Heniu", Location = "Warszaw", AvataruUrl = "/Content/img/UserNotExist.jpg", RepositoryCount = expectedResultRepositoryItems
            }, gitHubUser);
        }
예제 #5
0
        public static CommandResponse HandleCommand(GitHubUser user, Command command, bool autoRun = false)
        {
            try
            {
                if (autoRun)
                {
                    return(HandleAutoRunTracking(user));
                }

                string action = command.text.Split(' ')[0];
                switch (action)
                {
                case "search":  return(HandleSearch(user, command));

                case "track":   return(HandleTrack(user, command));

                case "untrack": return(HandleUntrack(user, command));

                case "help":    return(HandleHelp(user, command));

                case "to":      return(HandleNaturalLanguageSearch(user, command));
                }
                return(HandleHelp(user, command));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(new CommandResponse(":cry: There was an error processing your request. Please try again."));
            }
        }
예제 #6
0
        private static CommandResponse HandleUntrack(GitHubUser user, Command command)
        {
            try
            {
                string text = command.text, action = text.Split(' ')[0];
                string repository = text.Split(' ').Length >= 2 ? command.text.Substring(text.IndexOf(action) + (action.Length + 1)) : "";

                if (user.UntrackRepository(repository))
                {
                    if (repository == "*")
                    {
                        repository = "*all repositories*";
                    }
                    return(new CommandResponse("*Successfully untracked* " + repository));
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("*Here are your available tracked repositories:* ");
                    sb.AppendLine(FormatRepositoryList(user.TrackedRepositories));
                    return(new CommandResponse(sb.ToString()));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(new CommandResponse(":cry: There was an error processing your request. Please try again."));
            }
        }
예제 #7
0
        public void AutoTrackRepos(GitHubUser user)
        {
            ISolrOperations <CodeDoc> solr = ServiceLocator.Current.GetInstance <ISolrOperations <CodeDoc> >();
            var repos = user.GitHubClient.Repository.GetAllPublic().Result;

            foreach (var repo in repos)
            {
                var commits = user.GitHubClient.Repository.Commit.GetAll(repo.Owner.Login, repo.Name).Result;

                foreach (var commit in commits)
                {
                    if (commit.Author != null && commit.Author.Login != user.GitHubClient.User.Current().Result.Login)
                    {
                        continue;
                    }

                    var docsToAdd = GetDocumentsFromCommit(user, repo, commit);

                    foreach (var doc in docsToAdd)
                    {
                        solr.Add(doc);
                    }
                }
                Console.WriteLine("Finished tracking repository {0} for {1} to Solr", repo.Name, user.UUID);
                solr.Commit();
            }
        }
예제 #8
0
        private static CommandResponse HandleSearch(GitHubUser user, Command command)
        {
            string query   = ObtainQuery(command.text);
            var    results = SolrManager.Instance.PerformQuery(query, user.ChannelID);

            StringBuilder sb = new StringBuilder();

            if (results.Count == 0)
            {
                sb.AppendLine("*No results found*");
            }
            else
            {
                if (results.Count == 1)
                {
                    sb.AppendLine(String.Format("Found *{0}* result for *{1}*:", results.Count, query));
                }
                else
                {
                    sb.AppendLine(String.Format("Found *{0}* results for *{1}*:", results.Count, query));
                }
                sb.AppendLine(GenerateResults(results));
            }

            return(new CommandResponse(sb.ToString()));
        }
예제 #9
0
        public async Task AGitHubConnector_WillReturnAGitHubUsersRepositories_WhenSearchingSuccessfullyForUser_AndThereIsReposAvailable()
        {
            HttpResponseMessage expectedResponseFromGitHub = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(@"{login:'******'}")
            };

            Newtonsoft.Json.Linq.JArray expectedRepositories = Generators.JsonGitHubRepositories.Sample(50, 1).First();

            HttpResponseMessage expectedRepositoriesResponse = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(expectedRepositories.ToString())
            };

            Mock <IAppHttpClient> appHttpClient = new Mock <IAppHttpClient>();

            appHttpClient.SetupSequence(c => c.Get(It.IsAny <string>()))
            .ReturnsAsync(expectedResponseFromGitHub)
            .ReturnsAsync(expectedRepositoriesResponse);

            GitHubConnector connector = new GitHubConnector(appHttpClient.Object);
            GitHubUser      result    = await connector.FindUser("test");

            Assert.AreEqual(result.Repositories.ToList().Count, expectedRepositories.Count);
        }
예제 #10
0
        public async Task AGitHubConnector_WillReturnAGitHubUser_WhenSearchingSuccessfully()
        {
            Newtonsoft.Json.Linq.JObject expectedUser = Generators.JsonGitHubUser.Sample(50, 1).First();
            HttpResponseMessage          expectedResponseFromGitHub = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(expectedUser.ToString())
            };

            HttpResponseMessage expectedRepositoriesResponse = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("[]")
            };

            Mock <IAppHttpClient> appHttpClient = new Mock <IAppHttpClient>();

            appHttpClient.SetupSequence(c => c.Get(It.IsAny <string>()))
            .ReturnsAsync(expectedResponseFromGitHub)
            .ReturnsAsync(expectedRepositoriesResponse);

            GitHubConnector connector = new GitHubConnector(appHttpClient.Object);
            GitHubUser      result    = await connector.FindUser("test");

            Assert.AreEqual(result.FullName, expectedUser.GetValue("name").ToString());
        }
예제 #11
0
        public static HTMLDivElement CreateCard(GitHubUser user)
        {
            var card = new HTMLDivElement()
            {
                ClassName = "card",
                OnClick   = e => Window.Location.Href = user.html_url
            };

            var image = new HTMLDivElement()
            {
                ClassName = "image"
            };

            image.AppendChild(new HTMLImageElement()
            {
                Src = user.avatar_url
            });

            var content = new HTMLDivElement()
            {
                ClassName = "content"
            };

            content.AppendChild(new HTMLDivElement()
            {
                ClassName   = "header",
                TextContent = user.login
            });

            card.AppendChild(image);
            card.AppendChild(content);

            return(card);
        }
        public async Task <IActionResult> Put([FromBody] LibraryItem libraryItem)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Unauthorized());
            }

            var validationsErrors = ValidateLibraryItem(libraryItem);

            if (validationsErrors?.Count > 0)
            {
                return(BadRequest(validationsErrors));
            }

            // assign id, created date
            libraryItem.Id          = Guid.NewGuid().ToString();
            libraryItem.CreatedDate = DateTime.UtcNow;

            // set the author to current authenticated user
            GitHubUser user = new GitHubUser(User);

            libraryItem.Author = user.UserName;
            await StorageHelper.submitContributionForApproval(JsonConvert.SerializeObject(libraryItem));

            return(new JsonResult(libraryItem));
        }
예제 #13
0
        public IActionResult Index()
        {
            string secret = _config["GitHub:PersonalAccessToken"];
            //Debug.WriteLine("key: " + secret);

            string myGitJsonUser  = SendRequest("https://api.github.com/user", secret, "tbartlett17");
            string myGitJsonRepos = SendRequest("https://api.github.com/user/repos", secret, "tbartlett17");

            GitHubUser user = JsonConvert.DeserializeObject <GitHubUser>(myGitJsonUser);

            user.Repos = JsonConvert.DeserializeObject <IEnumerable <GitHubRepo> >(myGitJsonRepos);

            foreach (GitHubRepo r in user.Repos)
            {
                DateTime d1 = DateTime.Now;
                DateTime d2 = DateTime.Parse(r.Updated_at, null, System.Globalization.DateTimeStyles.RoundtripKind);
                TimeSpan ts = d1 - d2;
                r.Updated_at = ts.Days.ToString();
            }

            //Debug.WriteLine("1st repo owner: {0} 1st Repo Last Updated: {1}", user.Repos.FirstOrDefault().Owner.Name, user.Repos.FirstOrDefault().LastUpdated);
            //Debug.WriteLine("\n\nName: {0} \n Email: {1} Repo1: {2} \n\n", user.Name, user.Email, user.Repos.First().Owner.Login); //this seems to work so gucci
            //Debug.WriteLine("\n\n" + myGitJsonRepos + "\n\n");
            return(View(user));
        }
예제 #14
0
        private IEnumerable <GitHubUser> GetGitHubUsers()
        {
            var calculatedList = new List <GitHubUser>();

            try
            {
                var organizationName = ConfigurationManager.AppSettings.Get("usernameOrganization");
                var urlApiMembers    = string.Format("https://api.github.com/orgs/{0}/members", organizationName);

                var listGitHubUsers = JsonConvert.DeserializeObject <IList <GitHubUser> >(GetJsonString(urlApiMembers));

                foreach (var user in listGitHubUsers)
                {
                    GitHubUser gitHubUser = JsonConvert.DeserializeObject <GitHubUser>(GetJsonString(user.url));
                    user.avatar_url   = gitHubUser.avatar_url;
                    user.price        = EstimatedPrice(gitHubUser.public_repos, gitHubUser.followers);
                    user.public_repos = gitHubUser.public_repos;
                    user.followers    = gitHubUser.followers;
                    user.email        = gitHubUser.email;
                    user.name         = gitHubUser.name;
                    user.id           = gitHubUser.id;
                    user.login        = gitHubUser.login;

                    calculatedList.Add(user)
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(calculatedList.AsEnumerable());
        }
예제 #15
0
        public CommandResponse ProcessMessage()
        {
            // @TODO: Figure out why the slash command can't be properly deserialized when passed as an argument
            // as is, we have to do this hacky way to actualize our slash command from Slack
            var parameters = GetParametersFromRequest();
            var command    = GetCommandFromRequestParameters(parameters);

            foreach (var k in parameters.Keys)
            {
                Console.WriteLine("{0}: {1}", k, parameters[k]);
            }

            // @TODO: verify message is actually from slack via verification
            // @TODO: proper error code based on command execution

            string uuid = parameters["team_id"] + "." + parameters["channel_id"] + "." + parameters["user_id"];

            if (UserManager.Instance.IsGitHubAuthenticated(uuid))
            {
                GitHubUser user = UserManager.Instance.GetGitHubUser(uuid);
                return(CommandHandler.HandleCommand(user, command));
            }
            else
            {
                return(new CommandResponse(String.Format
                                           (
                                               "It looks like you haven't authorized us as a GitHub app in this channel! Please visit <{0}:{1}/api/github/getoauthurl?uuid={2}|this URL> to get set up",
                                               _options.WEBSITE_BASE_URL,
                                               _options.WEBSITE_PORT,
                                               uuid
                                           )));
            }
        }
예제 #16
0
 private static CommandResponse HandleAutoRunTracking(GitHubUser user)
 {
     if (user.AutoTrackRepos())
     {
         return(new CommandResponse("Thanks for supporting us! :heart_eyes: All of your public repositories were automatically tracked. To get help with available commands, please use `/knowhows help`."));
     }
     return(new CommandResponse("Thanks for supporting us! :heart_eyes: To get help with available commands, please type `/knowhows help`."));
 }
예제 #17
0
        /// <summary>
        /// removes a given user's repo from a channel
        /// </summary>
        /// <param name="user"></param>
        /// <param name="channel"></param>
        /// <param name="repository"></param>
        public void UntrackRepository(GitHubUser user, String repository)
        {
            ISolrOperations <CodeDoc> solr = ServiceLocator.Current.GetInstance <ISolrOperations <CodeDoc> >();

            solr.Delete(new SolrQuery("channel:" + user.ChannelID) && new SolrQuery("repo:" + repository) && new SolrQuery("committer_name:" + user.UserID));

            solr.Commit();
        }
        public async Task <ActionResult> GetResult(string searchCriteria)
        {
            GitHubUser result = await _gitHubSearchService.FindUser(searchCriteria);

            var viewModel = InitialiseViewModel(result);

            return(View(viewModel));
        }
예제 #19
0
        private List <CodeDoc> GetDocumentsFromCommit(GitHubUser user, Repository repo, GitHubCommit commit)
        {
            List <CodeDoc> cd = new List <CodeDoc>();

            var associated_files = user.GitHubClient.Repository.Commit.Get(repo.Id, commit.Sha).Result;

            foreach (var file in associated_files.Files)
            {
                string ext = Path.GetExtension(file.Filename);
                if (!SrcML.supportedExtensions.ContainsKey(ext))
                {
                    Console.WriteLine("Skipping {0} ({1}): not supported by SrcML", file.Filename, file.Sha);
                    continue;
                }

                if (file.Additions == 0 || String.Equals(file.Status, "removed"))
                {
                    Console.WriteLine("Skipping {0} ({1}): file was deleted", file.Filename, file.Sha);
                    continue;
                }

                // pulls out relevant information for later searching
                string parsedPatch = FullyParsePatch(file.Filename, file.RawUrl, file.Patch);

                if (String.IsNullOrEmpty(parsedPatch))
                {
                    Console.WriteLine("Discarding {0} ({1}): no relevant terms found in parsed patch", file.Filename, file.Sha);
                    continue;
                }

                CodeDoc doc = new CodeDoc
                {
                    Id                 = file.Sha,
                    Sha                = file.Sha,
                    Author_Date        = commit.Commit.Author.Date.Date,
                    Author_Name        = commit.Commit.Author.Name,
                    Channel            = user.ChannelID,
                    Committer_Name     = user.UserID,
                    Accesstoken        = user.GitHubAccessToken,
                    Filename           = file.Filename,
                    Previous_File_Name = file.PreviousFileName,
                    Raw_Url            = file.RawUrl,
                    Blob_Url           = file.BlobUrl,
                    Unindexed_Patch    = parsedPatch,
                    Patch              = parsedPatch,
                    Repo               = repo.Name,
                    Html_Url           = commit.HtmlUrl,
                    Message            = commit.Commit.Message,
                    Prog_Language      = SrcML.supportedExtensions[ext]
                };

                cd.Add(doc);
                Console.WriteLine("Adding {0} ({1}) to Solr", doc.Filename, doc.Sha);
            }

            return(cd);
        }
예제 #20
0
        private static CommandResponse HandleHelp(GitHubUser user, Command command)
        {
            StringBuilder sb = new StringBuilder();

            // @TODO i want to change commands to use c# attributes, so we can associate a function with a command name and description
            // shouldnt be hard coding this stuff here
            Attachment sub = new Attachment
            {
                fallback = "Help Commands",
                pretext  = "*Available commands:*",
                title    = "/knowhows to <query>",
                text     = "Performs a natural language search",
                color    = "#7CD197"
            };

            Attachment sub1 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows search <query>",
                text     = "Performs search for explicit request",
                color    = "#7CD197"
            };

            Attachment sub2 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows track <repository name>",
                text     = "Tracks and indexes one of your repositories",
                color    = "#5397c1"
            };

            Attachment sub3 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows untrack <repository name>",
                text     = "Untracks and unindexes one of your repositories",
                color    = "#5397c1"
            };

            Attachment sub4 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows help",
                text     = "Shows this help message",
                color    = "#c16883"
            };

            List <Attachment> suby = new List <Attachment>();

            suby.Add(sub);
            suby.Add(sub1);
            suby.Add(sub2);
            suby.Add(sub3);
            suby.Add(sub4);

            return(new CommandResponse(suby));
        }
예제 #21
0
        public async Task <List <Repository> > GetReposFromUser(GitHubUser user)
        {
            var uri      = new Uri(user.repos_url);
            var response = await _client.GetAsync(uri).ConfigureAwait(false);

            var contentString = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <List <Repository> >(contentString));
        }
예제 #22
0
        public async Task <GitHubUser> GetUser(string userName)
        {
            GitHubClient gitHubClient = GetConnectionToRepository();


            GitHubUser gitHubUser = await SetUser(userName, gitHubClient);

            return(gitHubUser);
        }
예제 #23
0
 public RepoViewModel(GitHubUser user, GitHubRepository repository, IEnumerable <GitHubCollaborator> collaborators, IIdentity currentUser, IEnumerable <Signature> signers, bool requireCla)
 {
     User          = user;
     Repository    = repository;
     Collaborators = collaborators;
     CurrentUser   = currentUser;
     Signers       = signers;
     RequireCla    = requireCla;
 }
예제 #24
0
 private GitHubUserViewModel MapGitUserViewModel(GitHubUser gitHubUser)
 {
     return(new GitHubUserViewModel
     {
         name = gitHubUser.name,
         location = gitHubUser.location,
         avatarUrl = gitHubUser.avatar_url,
         userRepos = new List <GitHubUserRepoViewModel>()
     });
 }
예제 #25
0
        public IActionResult Get()
        {
            if (User.Identity.IsAuthenticated)
            {
                GitHubUser user = new GitHubUser(User);
                return(Ok(user));
            }

            return(Unauthorized());
        }
예제 #26
0
        private static CommandResponse HandleHelp(GitHubUser user, Command command)
        {
            // TODO: move this out into separate file and deserialize in
            Attachment sub = new Attachment
            {
                fallback = "Help Commands",
                pretext  = "*Available commands:*",
                title    = "/knowhows to [query]",
                text     = "Performs a natural language search on a concept",
                color    = "#7CD197"
            };

            Attachment sub1 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows search [query]",
                text     = "Performs a literal search on a code term",
                color    = "#7CD197"
            };

            Attachment sub2 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows track [repository_name | *]",
                text     = "Tracks and indexes one or all (*) of your repositories",
                color    = "#5397c1"
            };

            Attachment sub3 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows untrack [repository_name | *]",
                text     = "Untracks and unindexes one or all (*) of your repositories",
                color    = "#5397c1"
            };

            Attachment sub4 = new Attachment
            {
                fallback = "Help Commands",
                title    = "/knowhows help",
                text     = "Shows this help message",
                color    = "#c16883"
            };

            List <Attachment> suby = new List <Attachment>()
            {
                sub,
                sub1,
                sub2,
                sub3,
                sub4
            };

            return(new CommandResponse(suby));
        }
예제 #27
0
        private static GitHubUser GetMockUser()
        {
            var mockUser = new GitHubUser
            {
                name       = "JhonnyLi",
                avatar_url = "",
                html_url   = ""
            };

            return(mockUser);
        }
예제 #28
0
        public IActionResult GetUser([FromRoute] string username)
        {
            GitHubUser user = this._gitHubConnector.GetUser(username);

            if (user != null)
            {
                return(this.Ok(user));
            }

            return(this.NotFound(new { Message = _validationMessages["InvalidUsername"].Value }));
        }
예제 #29
0
        public void AGitJsonPayload_ContainingAGitHubUser_WillMapCorrectlyToCurrentLocation()
        {
            Prop.ForAll(Generators.JsonGitHubUser.ToArbitrary(), json =>
            {
                dynamic user             = json;
                dynamic expectedLocation = user.location.ToString();
                GitHubUser result        = JsonConvert.DeserializeObject <GitHubUser>(json.ToString());

                Assert.AreEqual(expectedLocation, result.CurrentLocation);
            }).QuickCheck();
        }
예제 #30
0
        public void AGitJsonPayload_ContainingAGitHubUser_WillMapCorrectlyToAvatarUrl()
        {
            Prop.ForAll(Generators.JsonGitHubUser.ToArbitrary(), json =>
            {
                dynamic user = json;
                dynamic expectedAvatarUrl = user.avatar_url.ToString();
                GitHubUser result         = JsonConvert.DeserializeObject <GitHubUser>(json.ToString());

                Assert.AreEqual(expectedAvatarUrl, result.AvatarUrl);
            }).QuickCheck();
        }