Skip to content

Commit

Permalink
Add a test to confirm that frozen partial projects have different ver…
Browse files Browse the repository at this point in the history
…sions
  • Loading branch information
jasonmalinowski committed Aug 28, 2021
1 parent 3abef03 commit 2c3e6bb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2566,6 +2566,31 @@ public void TestProjectWithBrokenCrossLanguageReferenceHasIncompleteReferences()
Assert.Empty(project2.GetCompilationAsync().Result.ExternalReferences);
}

[Fact]
public async Task TestFrozenPartialProjectHasDifferentSemanticVersions()
{
using var workspace = CreateWorkspaceWithPartalSemantics();
var project = workspace.CurrentSolution.AddProject("CSharpProject", "CSharpProject", LanguageNames.CSharp);
project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;

var documentToFreeze = project.AddDocument("DocumentToFreeze.cs", SourceText.From(""));
var frozenDocument = documentToFreeze.WithFrozenPartialSemantics(CancellationToken.None);

// Because we had no compilation produced yet, we expect that only the DocumentToFreeze is in the compilation
Assert.NotSame(frozenDocument, documentToFreeze);
var tree = Assert.Single((await frozenDocument.Project.GetCompilationAsync()).SyntaxTrees);
Assert.Equal("DocumentToFreeze.cs", tree.FilePath);

// Versions should be different
Assert.NotEqual(
await documentToFreeze.Project.GetDependentSemanticVersionAsync(),
await frozenDocument.Project.GetDependentSemanticVersionAsync());

Assert.NotEqual(
await documentToFreeze.Project.GetSemanticVersionAsync(),
await frozenDocument.Project.GetSemanticVersionAsync());
}

[Fact]
public void TestFrozenPartialProjectAlwaysIsIncomplete()
{
Expand Down

0 comments on commit 2c3e6bb

Please sign in to comment.