public void AnalyzeRepoWithThingsThatArentReposShouldFail(string input) { var router = new RoutingState(); var kernel = new NSubstituteMockingKernel(); UserError error = null; var fixture = setupStandardFixture(router, kernel, () => kernel.Bind<IRepoAnalysisProvider>().To<RepoAnalysisProvider>()); using(UserError.OverrideHandlersForTesting(x => { error = x; return RecoveryOptionResult.CancelOperation; })) { fixture.AnalyzeRepo.Execute(input); } error.ShouldNotBeNull(); fixture.RepairButtonVisibility.ShouldNotEqual(Visibility.Visible); }
public void ScanningOurselvesShouldReturnResults() { var repoRootPath = CoreUtility.FindRepositoryRoot(IntegrationTestHelper.GetIntegrationTestRootDirectory()); var router = new RoutingState(); var kernel = new NSubstituteMockingKernel(); var fixture = setupStandardFixture(router, kernel, () => kernel.Bind<IRepoAnalysisProvider>().To<RepoAnalysisProvider>()); fixture.AnalyzeRepo.Execute(repoRootPath); fixture.AnalyzeRepo.ItemsInflight.Where(x => x == 0).First(); fixture.BranchInformation.ShouldNotBeNull(); fixture.CurrentRepoPath.ShouldEqual(repoRootPath); this.Log().Info(JsonConvert.SerializeObject(fixture.BranchInformation, Formatting.Indented)); // We should have both the WD and the branches fixture.BranchInformation.Any(x => x.BranchName.ToLowerInvariant().Contains("working")).ShouldBeTrue(); fixture.BranchInformation.Any(x => x.BranchName.ToLowerInvariant().Contains("master")).ShouldBeTrue(); // We should have examined some files fixture.BranchInformation.All(x => x.BadEncodingInfoHeader != null).ShouldBeTrue(); fixture.BranchInformation.All(x => x.BadEndingsInfoHeader != null).ShouldBeTrue(); fixture.BranchInformation.All(x => x.Model.TotalFilesExamined > 0).ShouldBeTrue(); // .gitignored files shouldn't show up var working = fixture.BranchInformation.First(x => x.BranchName == Constants.WorkingDirectory); working.Model.BadLineEndingFiles.Any(x => x.Key.ToLowerInvariant().Contains("_resharper")).ShouldBeFalse(); }