Exemplo n.º 1
0
        internal void InitializeForTests(SdkResolverLoader resolverLoader = null, IList <SdkResolver> resolvers = null)
        {
            if (resolverLoader != null)
            {
                _sdkResolverLoader = resolverLoader;
            }

            _specificResolversManifestsRegistry = null;
            _generalResolversManifestsRegistry  = null;
            _manifestToResolvers = null;
            _resolversList       = null;

            if (resolvers != null)
            {
                if (ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_4))
                {
                    _specificResolversManifestsRegistry = new List <SdkResolverManifest>();
                    _generalResolversManifestsRegistry  = new List <SdkResolverManifest>();
                    _manifestToResolvers = new Dictionary <SdkResolverManifest, IList <SdkResolver> >();

                    SdkResolverManifest sdkResolverManifest = new SdkResolverManifest(DisplayName: "TestResolversManifest", Path: null, ResolvableSdkRegex: null);
                    _generalResolversManifestsRegistry.Add(sdkResolverManifest);
                    _manifestToResolvers[sdkResolverManifest] = resolvers;
                }
                else
                {
                    _resolversList = resolvers;
                }
            }
        }
        /// <summary>
        /// Used for unit tests only.  This is currently only called through reflection in Microsoft.Build.Engine.UnitTests.TransientSdkResolution.CallResetForTests
        /// </summary>
        /// <param name="resolverLoader">An <see cref="SdkResolverLoader"/> to use for loading SDK resolvers.</param>
        /// <param name="resolvers">Explicit set of SdkResolvers to use for all SDK resolution.</param>
        internal void InitializeForTests(SdkResolverLoader resolverLoader = null, IList <SdkResolver> resolvers = null)
        {
            if (resolverLoader != null)
            {
                _sdkResolverLoader = resolverLoader;
            }

            _resolvers = resolvers;
        }
 //  Test hook
 internal void InitializeForTests(SdkResolverLoader resolverLoader = null, IList <SdkResolver> resolvers = null)
 {
     ((CachingSdkResolverService)_cachedSdkResolver).InitializeForTests(resolverLoader, resolvers);
 }