Exemple #1
0
        private IObservable<List<string>> LoadAllDependencies(IBundleManifest bundleManifest, string bundleName, Options options)
        {
            var loadedBundleNames = new List<string>();

            return bundleManifest
                .GetAllDependencies(bundleName)
                .Select(x => _cachedLoader
                    .LoadDependency(x, options, bundleName)
                    .Do(y =>
                    {
                        (y as IDisposable)?.Dispose();
                        loadedBundleNames.Add(x);
                    }))
                .WhenAll()
                .Select(x => loadedBundleNames)
                .DoOnError(ex => loadedBundleNames
                    .ForEach(x => _cachedLoader.UnloadDependency(x, bundleName))); // Todo DRY
        }
 private void SetupLoadDependencyReturns(IObservable <IBundle> observable, string bundleName = null)
 {
     _cachedLoader.LoadDependency(bundleName ?? Arg.Any <string>(), Arg.Any <Options>(), Arg.Any <string>())
     .Returns(observable);
 }