public void ShouldRemoveTagsFromIssuesThatBelongToPackages()
        {
            var packageTag = "MVC";
            var package = new PackageBuilder()
                .WithTag(packageTag)
                .WithCategory("category")
                .Build();
            var issue = new IssueBuilder()
                .WithLabel(packageTag)
                .WithId("id1")
                .WithState("open")
                .WithLabel("Bug")
                .Build();
            package.AddIssue(issue);

            var package2 = new PackageBuilder()
                .WithTag("MVC2")
                .WithCategory("category2")
                .Build();
            var issue2 = new IssueBuilder()
                .WithLabel(packageTag)
                .WithId("id2")
                .WithState("open")
                .WithLabel("Bug")
                .Build();
            package2.AddIssue(issue2);

            var indexViewModel = _mapper.ConvertToIndexViewModel(new[]{package,package2});

            var issueCategory = indexViewModel.PackageCategories[0].AcknowledgedIssues[0].Category;
            var issueCategory2 = indexViewModel.PackageCategories[1].AcknowledgedIssues[0].Category;

            Assert.Equal("Bug", issueCategory);
            Assert.Equal("Bug", issueCategory2);
        }
 public WhenCallingPackageIssueService()
 {
     _packageRepository = new Mock<IPackageRepository>();
     _issueRepository = new Mock<IIssueRepository>();
     _milestoneService = new Mock<IGithubMilestoneService>();
     _issueService = new PackageIssueProvider(_packageRepository.Object, _issueRepository.Object, _milestoneService.Object);
     _issueBuilder = new IssueBuilder();
     _packageBuilder = new PackageBuilder();
     _glimpseCorePackage = _packageBuilder
         .WithTag("Glimpse Core")
         .Build();
     StubPackages(_glimpseCorePackage);
 }
        public void GivenIssueAcrossDifferentPackagesUnderSameCategory_ShouldOnlyAddIssueToCategory()
        {
            
            var package = new PackageBuilder()
                .WithTag("Tag1")
                .WithCategory("Category1")
                .Build();
            var package2 = new PackageBuilder()
                .WithTag("Tag2")
                .WithCategory("Category1")
                .Build();
            var issue = new IssueBuilder()
                .WithId("1")
                .WithLabel("Tag1")
                .WithLabel("Tag2")
                .WithState("open")
                .Build();
            package.AddIssue(issue);
            package2.AddIssue(issue);
            var mapper = new GlimpsePackageViewModelMapper();

            var indexViewModel = mapper.ConvertToIndexViewModel(new[] {package,package2});

            var packageViewModel = indexViewModel.PackageCategories[0];
            Assert.Equal(1, packageViewModel.AcknowledgedIssues.Count);
        }
        public void ShouldAddClosedIssuesToCompletedIssues()
        {
            
            var package = new PackageBuilder()
                .WithTag("Tag1")
                .WithCategory("Category1")
                .Build();
            var issue = new IssueBuilder()
                .WithId("1")
                .WithLabel("Tag1")
                .WithLabel("Tag2")
                .WithState("closed")
                .Build();
            package.AddIssue(issue);
            var mapper = new GlimpsePackageViewModelMapper();

            var indexViewModel = mapper.ConvertToIndexViewModel(new[] {package});

            var packageViewModel = indexViewModel.PackageCategories[0];
            Assert.Equal(issue.Id, packageViewModel.CompletedIssues.First().IssueId);
        }