Beispiel #1
0
        [InlineData("WebDriver", "src/version.json", "0.149.20")]              // internal repository
        public void GetVersionTest(string repositoryName, string versionPath, string expectedVersion)
        {
            string path =
                Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                    @"Source\Repos",
                    repositoryName);


            const int count = 100;

            ILogger <VersionResolver> logger = count == 1 ? output.BuildLoggerFor <VersionResolver>() : NullLogger <VersionResolver> .Instance;

            for (int i = 0; i < count; i++)
            {
                GitRepository   repository = new GitRepository(path);
                VersionResolver resolver   = new WalkingVersionResolver(repository, versionPath, logger);

                var version = resolver.GetVersion();
                Assert.Equal(expectedVersion, version);

                if (count == 1)
                {
                    var stats = repository.GetCacheStatistics();
                }
            }
        }
        public void GetVersionManaged()
        {
            GitRepository repository = new GitRepository(RepositoryPath);

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

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

            this.Version = resolver.GetVersion();
        }