Files
AndroidDeviceStreaming/desktop/Ads.Desktop.Tests/ToolRelocationTests.cs
T

21 lines
769 B
C#

using Ads.Desktop;
using Xunit;
namespace Ads.Desktop.Tests;
public class ToolRelocationTests {
[Fact] public void RelocatedManagedPathUsesCurrentBundle() {
var name="relocate-"+Guid.NewGuid().ToString("N");
var executable=name+(OperatingSystem.IsWindows()?".exe":"");
var bundled=Path.Combine(AppContext.BaseDirectory,executable);
try {
File.WriteAllText(bundled,"fixture");
var old="C:/Users/TT/AppData/Local/Programs/TTSTD/ADS-Avalonia/"+executable;
Assert.Equal(bundled,DesktopPaths.ResolveTool(old,name));
}finally{File.Delete(bundled);}
}
[Fact] public void ValidCustomToolIsPreserved() {
var file=Path.GetTempFileName();
try{Assert.Equal(Path.GetFullPath(file),DesktopPaths.ResolveTool(file,"adb"));}
finally{File.Delete(file);}
}
}