19 lines
922 B
C#
19 lines
922 B
C#
using Launcher.Next.Autodesk;
|
|
using Xunit;
|
|
|
|
namespace Launcher.Next.Tests;
|
|
|
|
public sealed class PlantDiscoveryTests
|
|
{
|
|
private sealed class Registry(string? install) : IRegistryReader
|
|
{ public object? GetValue(string path,string name)=>path.Contains("ACAD-9117",StringComparison.Ordinal)&&name=="InstallDir"?install:null; }
|
|
|
|
[Fact]
|
|
public void Plant2026DiscoveryUsesPlantSpecificRegistryKey()
|
|
{
|
|
var directory=Path.Combine(Path.GetTempPath(),Guid.NewGuid().ToString("N"));Directory.CreateDirectory(Path.Combine(directory,"PLNT3D"));File.WriteAllBytes(Path.Combine(directory,"acad.exe"),[]);
|
|
try { var product=new PlantProductDiscovery(new Registry(directory)).DiscoverPlant3D(2026);Assert.NotNull(product);Assert.Equal("2026",product!.ProductVersion);Assert.Equal(Path.Combine(directory,"acad.exe"),product.ExecutablePath); }
|
|
finally { Directory.Delete(directory,true); }
|
|
}
|
|
}
|