mirror of
https://github.com/tgeorgiadis/quiver-launcher.git
synced 2026-12-06 11:47:59 -05:00
- Introduce Android app - Migrate project files to .NET 10, updating dependencies and workflows. - Migrate project to Avalonia 12 - Refactor App.axaml to include a ResourceDictionary for theme management. - Introduce new styles for gamepad navigation and focus rings. - Implement hosted main view management for better application lifecycle handling. - Remove deprecated MainWindow.Mods.cs file and related code. - Update README to reflect changes in project structure and requirements. Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.2 KiB
C#
77 lines
2.2 KiB
C#
using FluentAssertions;
|
|
using QuiverLauncher.Core.Models;
|
|
using QuiverLauncher.Models;
|
|
using QuiverLauncher.Services;
|
|
|
|
namespace QuiverLauncher.Tests;
|
|
|
|
public class GameStatusServiceTests
|
|
{
|
|
[Fact]
|
|
public async Task CheckStatusAsync_marks_missing_folder_as_not_installed()
|
|
{
|
|
var tempRoot = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
|
Directory.CreateDirectory(tempRoot);
|
|
|
|
try
|
|
{
|
|
var game = new GameInfo
|
|
{
|
|
Name = "Missing",
|
|
FolderName = "MissingFolder",
|
|
Repository = "owner/missing",
|
|
};
|
|
|
|
using var httpClient = new HttpClient();
|
|
await GameStatusService.CheckStatusAsync(game, httpClient, tempRoot);
|
|
|
|
game.Status.Should().Be(GameStatus.NotInstalled);
|
|
game.IsLoading.Should().BeFalse();
|
|
}
|
|
finally
|
|
{
|
|
Directory.Delete(tempRoot, true);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public async Task EnsureInstalledVersionFileAsync_writes_default_version()
|
|
{
|
|
var tempFile = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid():N}.txt");
|
|
|
|
try
|
|
{
|
|
var version = await GameStatusService.EnsureInstalledVersionFileAsync(tempFile);
|
|
version.Should().Be("0.0.0");
|
|
File.ReadAllText(tempFile).Trim().Should().Be("0.0.0");
|
|
}
|
|
finally
|
|
{
|
|
if (File.Exists(tempFile))
|
|
File.Delete(tempFile);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void TryRestoreAndroidPackageName_reads_sidecar_when_missing()
|
|
{
|
|
var gamePath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
|
|
Directory.CreateDirectory(gamePath);
|
|
|
|
try
|
|
{
|
|
File.WriteAllText(
|
|
Path.Combine(gamePath, GameStatusService.AndroidPackageFileName),
|
|
"com.example.game\n");
|
|
|
|
var game = new GameInfo { Name = "Android Game", FolderName = "AndroidGame" };
|
|
GameStatusService.TryRestoreAndroidPackageName(game, gamePath);
|
|
game.AndroidPackageName.Should().Be("com.example.game");
|
|
}
|
|
finally
|
|
{
|
|
Directory.Delete(gamePath, true);
|
|
}
|
|
}
|
|
}
|