public void WithFilePath_DummyTree() { var oldTree = new CSharpSyntaxTree.DummySyntaxTree(); var newTree = oldTree.WithFilePath("new.cs"); Assert.Equal("new.cs", newTree.FilePath); Assert.Equal(oldTree.ToString(), newTree.ToString()); }
public void WithFilePath_DummyTree() { var oldTree = new CSharpSyntaxTree.DummySyntaxTree(); var newTree = oldTree.WithFilePath("new.cs"); Assert.Equal(newTree.FilePath, "new.cs"); Assert.Equal(oldTree.ToString(), newTree.ToString()); }
public void WithRootAndOptions_DummyTree() { var dummy = new CSharpSyntaxTree.DummySyntaxTree(); var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}"); var newOptions = new CSharpParseOptions(); var newTree = dummy.WithRootAndOptions(newRoot, newOptions); Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()); Assert.Same(newOptions, newTree.Options); }
public void WithFilePath_Null() { SyntaxTree oldTree = new CSharpSyntaxTree.DummySyntaxTree(); Assert.Equal(string.Empty, oldTree.WithFilePath(null).FilePath); oldTree = SyntaxFactory.ParseSyntaxTree("", path: "old.cs"); Assert.Equal(string.Empty, oldTree.WithFilePath(null).FilePath); Assert.Equal(string.Empty, SyntaxFactory.ParseSyntaxTree("", path: null).FilePath); Assert.Equal(string.Empty, CSharpSyntaxTree.Create((CSharpSyntaxNode)oldTree.GetRoot(), path: null).FilePath); }