Exemplo n.º 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()
     });
Exemplo n.º 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()
     });
Exemplo n.º 3
0
        private IModelRepositoryMod Download()
        {
            var storage = new Mock <IModelStorage>(MockBehavior.Strict);

            storage.Setup(s => s.State).Returns(LoadingState.Loaded);
            storage.Setup(s => s.HasMod("asdf")).Returns(false);
            var selection = new ModSelectionDownload(storage.Object);
            var mock      = new Mock <IModelRepositoryMod>(MockBehavior.Strict);

            mock.Setup(o => o.GetCurrentSelection()).Returns(selection);
            mock.Setup(o => o.DownloadIdentifier).Returns("asdf");
            return(mock.Object);
        }