Skip to content

Commit

Permalink
fix tests for manual hooking
Browse files Browse the repository at this point in the history
  • Loading branch information
taubenangriff committed Jul 17, 2023
1 parent fce63f2 commit 784017b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/Imya.UnitTests/ExternalAccessTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public async Task ChangeActivationOnDeletedMod()
Directory.CreateDirectory(folder);
var mods = _collectionFactory.Get($@"{test}\mods");
await mods.LoadModsAsync();
mods.Hooks.AddHook(serviceProvider.GetRequiredService<RemovedModValidator>());
var hooks = new ModCollectionHooks();
hooks.HookTo(mods);
hooks.AddHook(serviceProvider.GetRequiredService<RemovedModValidator>());

// check
Assert.Single(mods);
Expand Down Expand Up @@ -111,7 +113,9 @@ public async Task ValidateOnDeletedMod()
modA.IsRemoved = true;

// trigger validation by deleting mod3
mods.Hooks.AddHook(serviceProvider.GetRequiredService<ModDependencyValidator>());
var hooks = new ModCollectionHooks();
hooks.HookTo(mods);
hooks.AddHook(serviceProvider.GetRequiredService<ModDependencyValidator>());
await mods.DeleteAsync(mods.Mods.Where(x => x.ModID == "[a] mod C").ToArray());

Assert.Equal(2, mods.Count);
Expand Down

0 comments on commit 784017b

Please sign in to comment.