public IObservable<T> Load<T>(Uri uri, Options options = null) { if (!Supports<T>(uri)) throw new NotSupportedException($"Uri not supported: {uri}"); // Todo only passed parsed uri var bundleName = uri.Host; return _bundleManifestLoader.Load() .ContinueWith(m => LoadAllDependencies(m, bundleName, options)) .ContinueWith(x => _cachedLoader .Load(bundleName, options) .DoOnError(ex => x.ForEach(y => _cachedLoader.UnloadDependency(y, bundleName)))) // Todo DRY .Cast<IBundle, T>(); }
private void SetupLoadReturns(IObservable <IBundle> observable) { _cachedLoader.Load(Arg.Any <string>(), Arg.Any <Options>()) .Returns(observable); }