Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
halgari committed Aug 1, 2023
1 parent 22ca8d2 commit e5dd01a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Text;
using System.Text.Json;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using NexusMods.DataModel.Abstractions;
using NexusMods.DataModel.Extensions;
using NexusMods.DataModel.Loadouts;
Expand All @@ -18,12 +19,15 @@ namespace NexusMods.Games.BethesdaGameStudios.Tests.SkyrimSpecialEditionTests;

public class SkyrimSpecialEditionTests : AGameTest<SkyrimSpecialEdition>
{
private readonly TestModDownloader _downloader;

/// <summary>
/// DI Constructor
/// </summary>
/// <param name="serviceProvider"></param>
public SkyrimSpecialEditionTests(IServiceProvider serviceProvider) : base(serviceProvider)
{
_downloader = serviceProvider.GetRequiredService<TestModDownloader>();

}

Expand Down Expand Up @@ -215,7 +219,7 @@ where file is PluginOrderFile
var pluginFilePath = pluginFile.To.CombineChecked(loadout.Value.Installation);

var path = BethesdaTestHelpers.GetDownloadableModFolder(FileSystem, "SkyrimBase");
var downloaded = await Downloader.DownloadFromManifestAsync(path, FileSystem);
var downloaded = await _downloader.DownloadFromManifestAsync(path, FileSystem);

var skyrimBase = await InstallModFromArchiveIntoLoadout(
loadout,
Expand All @@ -233,7 +237,7 @@ where file is PluginOrderFile
text.Should().NotContain("plugin_test.esp", "plugin_test.esp is not installed");

path = BethesdaTestHelpers.GetDownloadableModFolder(FileSystem, "PluginTest");
downloaded = await Downloader.DownloadFromManifestAsync(path, FileSystem);
downloaded = await _downloader.DownloadFromManifestAsync(path, FileSystem);
var pluginTest = await InstallModFromArchiveIntoLoadout(
loadout,
downloaded.Path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public void ConfigureServices(IServiceCollection services)
.AddUniversalGameLocator<SkyrimSpecialEdition>(new Version("1.6.659.0"))
.AddUniversalGameLocator<SkyrimLegendaryEdition>(new Version("1.9.32.0"))
.AddBethesdaGameStudios()
.AddCommon()
.Validate();
}

Expand Down
2 changes: 0 additions & 2 deletions tests/Games/NexusMods.Games.TestFramework/AGameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public abstract class AGameTest<TGame> where TGame : AGame
protected readonly LoadoutSynchronizer LoadoutSynchronizer;
protected readonly IArchiveAnalyzer ArchiveAnalyzer;
protected readonly IDataStore DataStore;
protected readonly TestModDownloader Downloader;

protected readonly Client NexusClient;
protected readonly IHttpDownloader HttpDownloader;
Expand Down Expand Up @@ -65,7 +64,6 @@ protected AGameTest(IServiceProvider serviceProvider)
LoadoutSynchronizer = serviceProvider.GetRequiredService<LoadoutSynchronizer>();
ArchiveAnalyzer = serviceProvider.GetRequiredService<IArchiveAnalyzer>();
DataStore = serviceProvider.GetRequiredService<IDataStore>();
Downloader = serviceProvider.GetRequiredService<TestModDownloader>();

NexusClient = serviceProvider.GetRequiredService<Client>();
HttpDownloader = serviceProvider.GetRequiredService<IHttpDownloader>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static IServiceCollection AddDefaultServicesForTesting(this IServiceColle
return serviceCollection
.AddLogging(builder => builder.SetMinimumLevel(LogLevel.Debug))
.AddOSInformation()
.AddCommon()
.AddFileSystem()
.AddSingleton<TemporaryFileManager>(_ => new TemporaryFileManager(FileSystem.Shared, prefix))
.AddSingleton<HttpClient>()
Expand Down

0 comments on commit e5dd01a

Please sign in to comment.