public async Task ShowResult_WhenCalled_WillReturn_ASearchResult()
        {
            Mock <IGitHubConnector> connector = new Mock <IGitHubConnector>();

            connector.Setup(c => c.FindUser(It.IsAny <string>())).Returns(Task.FromResult(new GitHubUser {
                Repositories = new List <GitHubRepository>()
            }));

            ResultController controller = new ResultController(new GitHubSearchService(connector.Object));
            ViewResult       result     = (ViewResult)await controller.GetResult("test");

            Assert.AreEqual(result.Model.GetType(), typeof(SearchResult));
        }
        public async Task ShowResult_WhenCalled_IfNoRepositories_ThenReturnViewWillMessageUsageSayingNoRepositories()
        {
            Mock <IGitHubConnector> connector = new Mock <IGitHubConnector>();
            GitHubUser expectedResult         = new GitHubUser
            {
                Alias        = "My Test",
                FullName     = "Juan Antonio",
                Repositories = new List <GitHubRepository>()
            };

            connector.Setup(c => c.FindUser(It.IsAny <string>())).Returns(Task.FromResult(expectedResult));

            ResultController controller = new ResultController(new GitHubSearchService(connector.Object));

            ViewResult result = (ViewResult)await controller.GetResult(expectedResult.Alias);

            SearchResult user = (SearchResult)result.Model;

            Assert.AreEqual(user.User.NoRepositoriesMessage, "It looks like this user has no repositories");
        }
        public async Task ShowResult_WhenCalled_IfNoLocation_WillInitializeitToNotApplicable()
        {
            Mock <IGitHubConnector> connector = new Mock <IGitHubConnector>();
            GitHubUser expectedResult         = new GitHubUser
            {
                Alias        = "My Test",
                FullName     = "Juan Antonio",
                Repositories = new List <GitHubRepository>()
            };

            connector.Setup(c => c.FindUser(It.IsAny <string>())).Returns(Task.FromResult(expectedResult));

            ResultController controller = new ResultController(new GitHubSearchService(connector.Object));

            ViewResult result = (ViewResult)await controller.GetResult(expectedResult.Alias);

            SearchResult user = (SearchResult)result.Model;

            Assert.AreEqual(user.User.CurrentLocation, "N/A");
        }