feat: add DSH IDE open-file references

This commit is contained in:
2026-08-17 11:52:48 +08:00
commit d96c11ae3d
42 changed files with 6991 additions and 0 deletions
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</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" />
</ItemGroup>
</Project>
@@ -0,0 +1,23 @@
using System;
using Xunit;
namespace Prophet.CoopWithDsh.Tests
{
public sealed class SnapshotModelTests
{
[Fact]
public void CreateDeduplicatesPathsAndPreservesDirtyState()
{
var snapshot = SnapshotModel.Create("one", 10, "F:\\Project\\App.sln", new[] {
new OpenDocument { Path = "F:\\Project\\main.cs", Label = "main.cs", Dirty = false },
new OpenDocument { Path = "f:\\project\\MAIN.cs", Label = "MAIN.cs", Dirty = true },
}, new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero));
Assert.Equal(1, snapshot.Version);
Assert.Equal("visualstudio", snapshot.Ide);
Assert.Single(snapshot.Documents);
Assert.True(snapshot.Documents[0].Dirty);
Assert.Equal("2026-01-01T00:00:00.0000000Z", snapshot.UpdatedAt);
}
}
}