Skip to content

Commit

Permalink
Added skeleton to test locals
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshVarty committed Jan 3, 2015
1 parent 7e666fc commit d404482
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/SourceBrowser.Tests/CSharpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,42 @@ public void M1(string p1, int p2, C1 p3)
//TODO: Test Parameters once PR #66 is merged.

}

public void TestLocals()
{

var solution = base.Solution(
Project(
ProjectName("Project1"),
Sign,
Document(
@"
class C1
{
public void M1()
{
string p1 = String.Empty;
int p2 = 0;
p2 = p2 + 1;
p1 = p1 + ""sample text""
}
}")));

WorkspaceModel ws = new WorkspaceModel("Workspace1", "");
FolderModel fm = new FolderModel(ws, "Project1");

var document = solution.Projects.SelectMany(n => n.Documents).Where(n => n.Name == "Document1.cs").Single();
var linkProvider = new ReferencesourceLinkProvider();

var walker = new SourceBrowser.Generator.DocumentWalkers.CSWalker(fm, document, linkProvider);
walker.Visit(document.GetSyntaxRootAsync().Result);
var documentModel = walker.GetDocumentModel();

var links = documentModel.Tokens.Select(n => n.Link).Where(n => n != null);

//TODO: Test locals once PR #66 is merged.

}
}
}

0 comments on commit d404482

Please sign in to comment.