Пример #1
0
 public static PersistedSelection?FromSelection(ModSelection selection)
 {
     // TODO: PersistedSelection shouldn't have to know about None/Loading details
     return(selection switch
     {
         ModSelectionNone => null,
         ModSelectionLoading => null,
         ModSelectionDisabled => new PersistedSelection(PersistedSelectionType.DoNothing, null, null),
         ModSelectionStorageMod storageModAction => storageModAction.StorageMod.GetStorageModIdentifiers(),
         ModSelectionDownload downloadAction => downloadAction.DownloadStorage.AsStorageIdentifier(),
         _ => throw new ArgumentException()
     });
Пример #2
0
 internal static ModAction Create(ModSelection selection, IModelRepositoryMod parent)
 {
     return(selection switch
     {
         ModSelectionNone => new SelectNone(),
         ModSelectionLoading => new SelectLoading(),
         ModSelectionDisabled => new SelectDisabled(),
         ModSelectionDownload download => new SelectStorage(download.DownloadStorage),
         ModSelectionStorageMod actionStorageMod => new SelectMod(actionStorageMod.StorageMod,
                                                                  CoreCalculation.GetModAction(parent, actionStorageMod.StorageMod)),
         _ => throw new ArgumentException()
     });
Пример #3
0
        private IModelRepositoryMod StorageMod(ModActionEnum action)
        {
            var storageMod = AutoselectTests.FromAction(action);
            var selection  = new ModSelectionStorageMod(storageMod);
            var mock       = new Mock <IModelRepositoryMod>(MockBehavior.Strict);

            mock.Setup(m => m.GetCurrentSelection()).Returns(selection);
            mock.Setup(m => m.State).Returns(LoadingState.Loaded);
            var matchHash   = TestUtils.GetMatchHash(1).Result;
            var versionHash = TestUtils.GetVersionHash(1).Result;

            mock.Setup(m => m.GetMatchHash()).Returns(matchHash);
            mock.Setup(m => m.GetVersionHash()).Returns(versionHash);
            return(mock.Object);
        }