public void GetUserRepositoriesService_ReturnsException()
        {
            // Arrange
            var mockGitHubRepoRepository = new Mock<IGitHubRepoRepository>();
            var mockUnitOfWork = new Mock<IUnitOfWork>();

            // create a list of repositories to return
            string owner = null;

            mockGitHubRepoRepository.Setup(s => s.GetUserRepositories(owner)).Throws(new System.Exception("Fake exception"));

            var svc = new GitHubRepoService(mockGitHubRepoRepository.Object, mockUnitOfWork.Object);

            // Act
            var result = (List<GitHubRepo>)svc.GetUserRepositories(null);

            // Assert
            // automatic
        }
        public void GetUserRepositoriesService_ReturnsRepositoriesList()
        {
            // Arrange
            var mockGitHubRepoRepository = new Mock<IGitHubRepoRepository>();
            var mockUnitOfWork = new Mock<IUnitOfWork>();

            // create a list of repositories to return
            var owner = "fakeUserName";
            var userRepositories = (List<GitHubRepo>)MockHelper.GenerateFakeRepos(owner);

            mockGitHubRepoRepository.Setup(s => s.GetUserRepositories(owner)).Returns(userRepositories);

            var svc = new GitHubRepoService(mockGitHubRepoRepository.Object, mockUnitOfWork.Object);

            // Act
            var result = (List<GitHubRepo>)svc.GetUserRepositories(owner);

            // Assert
            Assert.IsTrue(result.Count == userRepositories.Count);
        }
        public void GetUserRepositoriesService_ifUserNameIsNull_ReturnsNull()
        {
            // Arrange
            var mockGitHubRepoRepository = new Mock<IGitHubRepoRepository>();
            var mockUnitOfWork = new Mock<IUnitOfWork>();

            // create a list of repositories to return
            string owner = null;
            List<GitHubRepo> userRepositories = null;

            mockGitHubRepoRepository.Setup(s => s.GetUserRepositories(owner)).Returns(userRepositories);

            var svc = new GitHubRepoService(mockGitHubRepoRepository.Object, mockUnitOfWork.Object);

            // Act
            var result = (List<GitHubRepo>)svc.GetUserRepositories(null);

            // Assert
            Assert.IsNull(result);
        }