public void Should_Read_Issue_Correct() { // Given var fixture = new DupFinderIssuesProviderFixture("DupFinder.xml"); // When var issues = fixture.ReadIssues().ToList(); // Then issues.Count.ShouldBe(5); issues.Count(i => i.FilePath() == "Src/Foo.cs" && i.Line == 16 && i.EndLine == 232).ShouldBe(1); var issueToVerify = issues.Single(i => i.FilePath() == "Src/Foo.cs" && i.Line == 16 && i.EndLine == 232); IssueChecker.Check( issueToVerify, IssueBuilder.NewIssue( ExpectedIssueIdentifier, ExpectedIssueMessage, "Cake.Issues.DupFinder.DupFinderIssuesProvider", "DupFinder") .WithMessageInMarkdownFormat(ExpectedIssueMarkdownMessage) .WithMessageInHtmlFormat(ExpectedIssueHtmlMessage) .InFile(@"Src\Foo.cs", 16, 232, null, null) .OfRule("dupFinder") .WithPriority(IssuePriority.Warning) .Create()); }
public void ShouldNotSetTheFileLinkWhenSettingsWereNotProvided() { // Given var fixture = new DupFinderIssuesProviderFixture("DupFinder.xml"); // When IList <IIssue> issues = fixture.ReadIssues().ToList(); foreach (var issue in issues) { issue.FileLink.ShouldBeNull(); } }
public void ShouldReadBigFileWith1000DuplicatesInUnder200Milliseconds() { // Given var fixture = new DupFinderIssuesProviderFixture("DupFinder1000Duplicates.xml"); IList <IIssue> issues = new List <IIssue>(); // When var sw = Stopwatch.StartNew(); for (var i = 0; i < 10; i++) { issues = fixture.ReadIssues().ToList(); } sw.Stop(); // Then issues.Count.ShouldBe(2885); sw.ElapsedMilliseconds.ShouldBeLessThan(2000); }
public void ShouldAddRealUrlsToMessagesIfFileLinkSettingsWereProvided() { // Given var repositoryUrl = new Uri("http://*****:*****@"Src\Foo.cs", 16, 232, null, null) .OfRule("dupFinder") .WithPriority(IssuePriority.Warning) .Create()); }