fix: support Visual Studio 2026 package loading
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Prophet.CoopWithDsh\SnapshotModels.cs" Link="SnapshotModels.cs" />
|
||||
<Compile Include="..\Prophet.CoopWithDsh\SnapshotPublisher.cs" Link="SnapshotPublisher.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
namespace Prophet.CoopWithDsh.Tests
|
||||
@@ -19,5 +20,32 @@ namespace Prophet.CoopWithDsh.Tests
|
||||
Assert.True(snapshot.Documents[0].Dirty);
|
||||
Assert.Equal("2026-01-01T00:00:00.0000000Z", snapshot.UpdatedAt);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PublisherWritesProtocolV1WithoutExternalJsonRuntime()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "coop-with-dsh-test-" + Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
using (var publisher = new SnapshotPublisher(root))
|
||||
{
|
||||
var snapshot = SnapshotModel.Create(publisher.InstanceId, 42, null, new[] {
|
||||
new OpenDocument { Path = "F:\\Project\\main.cs", Label = "main.cs", Dirty = true },
|
||||
}, new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero));
|
||||
publisher.Publish(snapshot);
|
||||
var json = File.ReadAllText(publisher.FilePath);
|
||||
|
||||
Assert.Contains("\"version\":1", json);
|
||||
Assert.Contains("\"ide\":\"visualstudio\"", json);
|
||||
Assert.Contains("\"documents\":[{", json);
|
||||
Assert.Contains("\"dirty\":true", json);
|
||||
Assert.DoesNotContain("\"workspace\"", json);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(root)) Directory.Delete(root, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user