public void GetExpectedBuildErrors_No_Comments() { var code = @"public class Foo { public void Bar(object o) { Console.WriteLine(o); } }"; var expectedErrors = IssueLocationCollector.GetExpectedBuildErrors(SourceText.From(code).Lines); expectedErrors.Should().BeEmpty(); }
public void GetExpectedBuildErrors_Multiple_ExpectedErrors() { var code = @"public class Foo { public void Bar(object o) // Error [CS1234,CS2345,CS3456] { } }"; var expectedErrors = IssueLocationCollector.GetExpectedBuildErrors(SourceText.From(code).Lines); expectedErrors.Should().HaveCount(3); expectedErrors.Select(l => l.IsPrimary).Should().Equal(new[] { true, true, true }); expectedErrors.Select(l => l.LineNumber).Should().Equal(new[] { 3, 3, 3 }); expectedErrors.Select(l => l.IssueId).Should().Equal(new[] { "CS1234", "CS2345", "CS3456" }); }
public void GetExpectedBuildErrors_ExpectedErrors() { var code = @"public class Foo { public void Bar(object o) // Error [CS1234] { // Error@+1 [CS3456] Console.WriteLine(o); } }"; var expectedErrors = IssueLocationCollector.GetExpectedBuildErrors(SourceText.From(code).Lines); expectedErrors.Should().HaveCount(2); expectedErrors.Select(l => l.IsPrimary).Should().Equal(new[] { true, true }); expectedErrors.Select(l => l.LineNumber).Should().Equal(new[] { 3, 6 }); }