internal void TestInequality(string lower, string higher) { var lowerVersion = new HostingBundleVersion(lower); var higherVersion = new HostingBundleVersion(higher); TestUtils.EqualityComparisonTestUtils <HostingBundleVersion> .TestInequality(lowerVersion, higherVersion); }
internal void TestEquality(string input1, string input2) { var version1 = new HostingBundleVersion(input1); var version2 = new HostingBundleVersion(input2); TestUtils.EqualityComparisonTestUtils <HostingBundleVersion> .TestEquality(version1, version2); }
private static void ParseVersionAndArch(string displayName, string bundleCachePath, out BundleVersion version, out BundleArch arch) { var match = Regexes.BundleDisplayNameRegex.Match(displayName); var cachePathMatch = Regexes.BundleCachePathRegex.Match(bundleCachePath); var archString = cachePathMatch.Groups[Regexes.ArchGroupName].Value ?? string.Empty; var versionString = cachePathMatch.Groups[Regexes.VersionGroupName].Value; var hasAuxVersion = cachePathMatch.Groups[Regexes.AuxVersionGroupName].Success; var footnote = hasAuxVersion ? string.Format(LocalizableStrings.HostingBundleFootnoteFormat, displayName, versionString) : null; switch (match.Groups[Regexes.TypeGroupName].Value) { case "SDK": version = new SdkVersion(versionString); break; case "Runtime": version = new RuntimeVersion(versionString); break; case "ASP.NET": version = new AspNetRuntimeVersion(versionString); break; case "Windows Server Hosting": version = new HostingBundleVersion(versionString, footnote); break; default: throw new ArgumentException(); } switch (archString) { case "x64": arch = BundleArch.X64; break; case "x86": arch = BundleArch.X86; break; case "": arch = BundleArch.X64 | BundleArch.X86; break; default: throw new ArgumentException(); } }
private static void TestProperties(HostingBundleVersion version, string footnote, int major, int minor, int patch, bool isPrerelease, bool hasFootnote, string toStringExpected, string toStringWithAsteriskExpected) { version.Major.Should().Be(major); version.Minor.Should().Be(minor); version.Patch.Should().Be(patch); version.IsPrerelease.Should().Be(isPrerelease); version.MajorMinor.Should().Be(new MajorMinorVersion(major, minor)); version.Footnote.Should().Be(footnote); version.Type.Should().Be(BundleType.HostingBundle); version.BeforePatch.Should().Be(new MajorMinorVersion(major, minor)); version.HasFootnote.Should().Be(hasFootnote); version.ToString().Should().Be(toStringExpected); version.ToStringWithAsterisk().Should().Be(toStringWithAsteriskExpected); }
private static void ParseVersionAndArch(RegistryKey registryKey, string displayName, string bundleCachePath, out BundleVersion version, out BundleArch arch) { var match = Regexes.BundleDisplayNameRegex.Match(displayName); var cachePathMatch = Regexes.BundleCachePathRegex.Match(bundleCachePath); var archString = cachePathMatch.Groups[Regexes.ArchGroupName].Value ?? string.Empty; var versionFromCachePath = cachePathMatch.Groups[Regexes.VersionGroupName].Value; // Note: ASP.NET Core runtimes do not include version in the cache path, need to get version from registry: var versionFromRegistry = string.Join('.', (registryKey.GetValue("DisplayVersion") as string).Split('.').Take(3)); var versionString = string.IsNullOrEmpty(versionFromCachePath) ? versionFromRegistry : versionFromCachePath; var hasAuxVersion = cachePathMatch.Groups[Regexes.AuxVersionGroupName].Success; var footnote = hasAuxVersion ? string.Format(LocalizableStrings.HostingBundleFootnoteFormat, displayName, versionString) : null; if (string.IsNullOrEmpty(displayName) || string.IsNullOrEmpty(versionString) || string.IsNullOrEmpty(archString)) { version = null; arch = BundleArch.X64 | BundleArch.X86; return; } switch (match.Groups[Regexes.TypeGroupName].Value) { case "SDK": version = new SdkVersion(versionString); break; case "Runtime": version = new RuntimeVersion(versionString); break; case "ASP.NET": version = new AspNetRuntimeVersion(versionString); break; case "Windows Server Hosting": version = new HostingBundleVersion(versionString, footnote); break; default: throw new ArgumentException(); } switch (archString) { case "x64": arch = BundleArch.X64; break; case "x86": arch = BundleArch.X86; break; case "": arch = BundleArch.X64 | BundleArch.X86; break; default: throw new ArgumentException(); } }
internal void TestInequalityNull(string input) { var version = new HostingBundleVersion(input); TestUtils.EqualityComparisonTestUtils <HostingBundleVersion> .TestInequalityNull(version); }