public void GetVersionWithMemoryCacheBenchmark()
        {
            GitRepository repository = new GitRepository(RepositoryPath);

            repository.CacheFactory = (pack) => new GitPackMemoryCache(pack);

            VersionResolver resolver = new VersionResolver(repository, VersionPath, NullLogger <VersionResolver> .Instance);

            this.Version = resolver.GetVersion();
        }
Beispiel #2
0
        [InlineData("Cuemon", "version.json", "6.0.0-preview.{height}.11")] // https://github.com/gimlichael/Cuemon
        public void GetVersionTest(string repositoryName, string versionPath, string expectedVersion)
        {
            string path =
                Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                    @"Source\Repos",
                    repositoryName);

            GitRepository   repository = new GitRepository(path);
            VersionResolver resolver   = new VersionResolver(repository, versionPath, NullLogger <VersionResolver> .Instance);

            var version = resolver.GetVersion();

            Assert.Equal(expectedVersion, version);
        }
Beispiel #3
0
        private string GetInstalledRuntimeVersion(ContextName context)
        {
            using (var contextKey = PackageRegistry.OpenRegistryRoot(false, context))
            {
                if (contextKey == null)
                {
                    return(null);
                }

                string installationPath = (string)contextKey.GetValue("InstallationPath");

                return(VersionResolver.GetVersion(
                           PackageManager.GetEntryAssemblyLocation(installationPath)
                           ));
            }
        }