public void GetFileLineReference_NUnitWithTwoInStatementsWithOneInsidePipeCharacter_ReturnsExpectedFileName() { string output = @" in | at NunitFoo.MyTest.Test() in c:\test\Test.cs:line 11"; FileLineReference lineRef = OutputTextLineParser.GetFileLineReference(output); Assert.AreEqual(@"c:\test\Test.cs", lineRef.FileName); }
void ExceptionViewDoubleClick(object sender, EventArgs e) { string fullText = exceptionView.Text; // Any text? if (fullText.Length > 0) { //int line = textEditorControl.ActiveTextAreaControl.Caret.Line; //string textLine = TextUtilities.GetLineAsString(textEditorControl.Document, line); Point clickPos = exceptionView.PointToClient(Control.MousePosition); int index = exceptionView.GetCharIndexFromPosition(clickPos); int start = index; // find start of current line while (--start > 0 && fullText[start - 1] != '\n') { ; } // find end of current line while (++index < fullText.Length && fullText[index] != '\n') { ; } string textLine = fullText.Substring(start, index - start); FileLineReference lineReference = OutputTextLineParser.GetFileLineReference(textLine); if (lineReference != null) { // Open matching file. FileService.JumpToFilePosition(lineReference.FileName, lineReference.Line, lineReference.Column); } } }
public void CompilerFailure() { string output = "c:\\test\\NunitFoo\\NunitFoo.Tests\\FooTest.cs(22,10)"; FileLineReference lineRef = OutputTextLineParser.GetFileLineReference(output); Assert.AreEqual(lineRef.FileName, "c:\\test\\NunitFoo\\NunitFoo.Tests\\FooTest.cs"); Assert.AreEqual(21, lineRef.Line); Assert.AreEqual(9, lineRef.Column); }
public void GetFileLineReference_CompilerFailure_ReturnsExpectedFileLineReference() { string output = @"c:\test\NunitFoo\NunitFoo.Tests\FooTest.cs(22,10)"; FileLineReference lineRef = OutputTextLineParser.GetFileLineReference(output); Assert.AreEqual(@"c:\test\NunitFoo\NunitFoo.Tests\FooTest.cs", lineRef.FileName); Assert.AreEqual(22, lineRef.Line); Assert.AreEqual(10, lineRef.Column); }