private IModsCache PrepareMockedModsCache() { var mock = new Mock <ModsCache>(); var mods = ModHelpers.CreateModsList(_fixture); mock .Setup(x => x.Mods) .Returns(mods); return(mock.Object); }
public void RequiredMods_ModsAndDlcs_Matches() { var modsList = ModHelpers.CreateModsList(_fixture); var dlcsList = DlcHelpers.CreateDlcsList(_fixture); var expectedCombinedList = modsList .Where(x => x.Type == ModType.Required) .Concat(dlcsList) .ToList(); var modset = new Modset { Mods = modsList.Cast <IMod>().ToHashSet(), Dlcs = dlcsList.ToHashSet() }; modset.RequiredMods.Should().BeEquivalentTo(expectedCombinedList); }
public async Task AddOrUpdateModsInCache_SomeModsDataChanged_CacheUpdated() { var mods = ModHelpers.CreateModsList(_fixture); foreach (var mod in mods) { _fileSystemMock.Directory.CreateDirectory(mod.Directory); mod.Directory = _fixture.Create <string>(); } var newMods = ModHelpers.CreateModsList(_fixture); var allMods = mods.Concat(newMods).ToList(); var modsCache = GetModsCache(); var result = await modsCache.AddOrUpdateModsInCache(allMods); result.ShouldBeSuccess(allMods.Cast <IMod>().ToList()); }