public void NupkgReinstallDoesntRemoveTemplates()
        {
            const string nupkgToInstallName = "TestNupkgInstallTemplate.0.0.1.nupkg";
            const string checkTemplateName  = "nupkginstall";   // this is the short name of the template in the nupkg that gets installed.

            ITemplateEngineHost host = CreateHostWithVirtualizedHive(HostIdentifier, HostVersion);

            Assert.NotNull(host);

            ITelemetryLogger telemetryLogger = new TelemetryLogger(null, false);
            int initializeResult             = New3Command.Run(CommandName, host, telemetryLogger, null, new string[] { });

            Assert.Equal(0, initializeResult);

            string codebase      = typeof(NupkgInstallTests).GetTypeInfo().Assembly.Location;
            Uri    cb            = new Uri(codebase);
            string asmPath       = cb.LocalPath;
            string dir           = Path.GetDirectoryName(asmPath);
            string pathToInstall = Path.Combine(dir, "TemplateInstallTests", "TestTemplates", nupkgToInstallName);

            Assert.True(File.Exists(pathToInstall), $"directory didnt exist: {pathToInstall}");

            string[] installArgs = new[]
            {
                "--install",
                pathToInstall
            };

            // install the test pack
            int firstInstallResult = New3Command.Run(CommandName, host, telemetryLogger, null, installArgs);

            Assert.Equal(0, firstInstallResult);

            EngineEnvironmentSettings environemnt    = new EngineEnvironmentSettings(host, x => new SettingsLoader(x));
            SettingsLoader            settingsLoader = (SettingsLoader)environemnt.SettingsLoader;
            IHostSpecificDataLoader   hostDataLoader = new MockHostSpecificDataLoader();

            // check that the template was installed from the first install.
            IReadOnlyCollection <ITemplateMatchInfo> allTemplates = TemplateResolver.PerformAllTemplatesQuery(settingsLoader.UserTemplateCache.TemplateInfo, hostDataLoader);

            Assert.Contains(checkTemplateName, allTemplates.Select(t => t.Info.ShortName));

            // install the same test pack again
            int secondInstallResult = New3Command.Run(CommandName, host, telemetryLogger, null, installArgs);

            Assert.Equal(0, secondInstallResult);

            settingsLoader.Reload();

            // check that the template is still installed after the second install.
            IReadOnlyCollection <ITemplateMatchInfo> allTemplatesAfterSecondInstall = TemplateResolver.PerformAllTemplatesQuery(settingsLoader.UserTemplateCache.TemplateInfo, hostDataLoader);

            Assert.Contains(checkTemplateName, allTemplatesAfterSecondInstall.Select(t => t.Info.ShortName));
        }