Sync desktop daily logs and fix emulator ADB upstream connections

This commit is contained in:
tongtong committed 2026-11-13 11:57:07 +08:00
1 parent 87e1fff59b
commit 0d269f3ded
15 files changed
+139 -12

No files matched your search

@@ -0,0 +1,17 @@
using Ads.Desktop;
using Xunit;
namespace Ads.Desktop.Tests;
public class DailyLogTests {
[Fact] public void PersistsAndCleansOnlyOwnedExpiredLogs() {
var folder=Path.Combine(Path.GetTempPath(),Guid.NewGuid().ToString());
Directory.CreateDirectory(folder);
try {
File.WriteAllText(Path.Combine(folder,"ads-2000-01-01.1.log"),"old");
File.WriteAllText(Path.Combine(folder,"ads-2000-01-01-custom.log"),"keep");
new DailyLog(folder).Write("connection diagnostic");
Assert.False(File.Exists(Path.Combine(folder,"ads-2000-01-01.1.log")));
Assert.True(File.Exists(Path.Combine(folder,"ads-2000-01-01-custom.log")));
Assert.Contains("connection diagnostic",File.ReadAllText(Path.Combine(folder,$"ads-{DateTime.Now:yyyy-MM-dd}.log")));
} finally { Directory.Delete(folder,true); }
}
}