예제 #1
0
        public void AssertAssemblyVersionGetsGitVersion()
        {
            var assemblyPath = GetAssemblyFullPath("OctoPack.Tests.SampleGitVersionAssembly");
            var gitversion   = AssemblyExtensions.GetNuGetVersionFromGitVersionInformation(assemblyPath);

            Assert.That(gitversion, Is.EqualTo("1.1.1-tests"));
        }
예제 #2
0
        public void AssertAssemblyVersion_WhereNoGitVersionProperty_ReturnsNull()
        {
            var assemblyPath = GetAssemblyFullPath("OctoPack.Tests.NonGitVersionAssembly");
            var gitversion   = AssemblyExtensions.GetNuGetVersionFromGitVersionInformation(assemblyPath);

            Assert.That(gitversion, Is.Null);
        }
예제 #3
0
        public void AssertAssembly_WhereDependentAssemblyNotEventInSource_GetsGitVersion()
        {
            var assemblyPath = GetAssemblyFullExceptionPath("OctoPack.Tests.SampleGitVersionAssembly");
            var gitversion   = AssemblyExtensions.GetNuGetVersionFromGitVersionInformation(assemblyPath);

            Assert.That(gitversion, Is.EqualTo("1.1.1-tests"));
        }
예제 #4
0
        private TaskItem UseNuGetVersionFromGitVersionInformation(string path, FileVersionInfo info)
        {
            var nugetVersion = AssemblyExtensions.GetNuGetVersionFromGitVersionInformation(path);

            if (string.IsNullOrEmpty(nugetVersion))
            {
                throw new VersionNotFoundException(string.Format("The NuGet version obtained for GitVersion information is {0}", nugetVersion));
            }

            LogMessage(string.Format("Found GitVersion information, using version: {0}", nugetVersion),
                       MessageImportance.Normal);
            // If we find a GitVersion information in the assembly, we can be pretty sure it's got the stuff we want, so let's use that.
            return(new TaskItem(info.FileName, new Hashtable
            {
                { "Version", nugetVersion },
            }));
        }