public void RepoFactory_CreateRepositoryForArguments_CustomNuGetRepo_Overwrites_Default()
        {
            var settings = new ProcessedArgsBuilder("SomePackage", "SomeoutDir")
                           .SetCustomNuGetRepository("file:///customrepo/path")
                           .SetPackageVersion("0.0.1")
                           .SetLanguage("cs")
                           .Build();
            var logger = new TestLogger();

            var repo = NuGetRepositoryFactory.CreateRepositoryForArguments(logger, settings, "c:\\dummy\\config\\");

            repo.Should().BeOfType <LazyLocalPackageRepository>();
            repo.Source.Should().Be("/customrepo/path");
            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(0);
        }
        public void RepoFactory_CreateRepositoryForArguments_NoCustomNuGetRepo_DefaultUsed()
        {
            // Create a valid config settings file that specifies the package sources to use
            var configXml          = @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
  <packageSources>
    <add key=""local1"" value=""d:\cache1"" />
    <add key=""local2"" value=""c:\cache2"" />
  </packageSources>
  <disabledPackageSources>
    <add key=""local1_inactive"" value=""true"" />
  </disabledPackageSources>
</configuration>";
            var fullConfigFilePath = WriteConfigFile(configXml);

            var settings = new ProcessedArgsBuilder("SomePackage", "SomeoutDir")
                           .SetPackageVersion("0.0.1")
                           .SetLanguage("cs")
                           .Build();

            var logger = new TestLogger();

            var actualRepo = NuGetRepositoryFactory.CreateRepositoryForArguments(logger, settings,
                                                                                 Path.GetDirectoryName(fullConfigFilePath));

            actualRepo.Should().BeOfType <AggregateRepository>();
            AggregateRepository actualAggregateRepo = (AggregateRepository)actualRepo;

            // There might be other machine-level nuget.config settings that have been picked,
            // so we'll only check that the known package sources above were found
            AssertExpectedPackageSourcesExist(actualAggregateRepo,
                                              "d:\\cache1",
                                              "c:\\cache2");

            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(0);
        }