Example #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 SetupManifestDependencyBundlesReturn(string[] dependentBundles = null, string bundleName = null)
 {
     _bundleManifest.GetAllDependencies(bundleName ?? Arg.Any <string>())
     .Returns(dependentBundles ?? new string[0]);
 }