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

            // create new repo fake
            var repo = MockHelper.GetRepoByName("owner1", "repoNameFake1");

            int newId = 26;
            mockGitHubRepoRepository.Setup(s => s.AddandReturn(repo)).Returns((GitHubRepo g) =>
            {
                g.Id = newId;
                return g;
            });

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

            // Act
            svc.MarkAsFavorite(repo);

            // Assert
            Assert.AreEqual(newId, repo.Id);
            mockUnitOfWork.Verify(m=>m.Commit(), Times.Once);
        }
        public void MarkAsFavoriteService_ReturnsException()
        {
            // Arrange
            var mockGitHubRepoRepository = new Mock<IGitHubRepoRepository>();
            var mockUnitOfWork = new Mock<IUnitOfWork>();

            // create new repo fake
            GitHubRepo repo = new GitHubRepo();

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

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

            // Act
            var repoReturned = svc.MarkAsFavorite(repo);

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

            // create new repo fake
            GitHubRepo repo = null;

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

            // Act
            var repoReturned = svc.MarkAsFavorite(repo);

            // Assert
            Assert.IsNull(repoReturned);
            mockUnitOfWork.Verify(m => m.Commit(), Times.Never);
        }