/// <summary>
        /// Set default credential provider for the HttpClient, which is used by V2 sources.
        /// Also set up authenticated proxy handling for V3 sources.
        /// </summary>
        protected void SetDefaultCredentialProvider(Lazy <MsBuildToolset> msbuildDirectory)
        {
            PluginDiscoveryUtility.InternalPluginDiscoveryRoot = new Lazy <string>(() => PluginDiscoveryUtility.GetInternalPluginRelativeToMSBuildDirectory(msbuildDirectory.Value.Path));
            CredentialService = new CredentialService(new AsyncLazy <IEnumerable <ICredentialProvider> >(() => GetCredentialProvidersAsync()), NonInteractive, handlesDefaultCredentials: PreviewFeatureSettings.DefaultCredentialsAfterCredentialProviders);

            CoreV2.NuGet.HttpClient.DefaultCredentialProvider = new CredentialServiceAdapter(CredentialService);

            HttpHandlerResourceV3.CredentialService = new Lazy <Configuration.ICredentialService>(() => CredentialService);

            HttpHandlerResourceV3.CredentialsSuccessfullyUsed = (uri, credentials) =>
            {
                // v2 stack credentials update
                CoreV2.NuGet.CredentialStore.Instance.Add(uri, credentials);
            };
        }
        public void PluginDiscoveryUtility_GetsNuGetPluginPathGivenMSBuildDirectory(string given, string expected)
        {
            var result = PluginDiscoveryUtility.GetInternalPluginRelativeToMSBuildDirectory(given);

            Assert.Equal(expected, result);
        }