Contains Methods for discovering information about CLR Versions
        public void ParseVersionsProperlyTest()
        {
            var UserAgent = @"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)";

            var expected = new Dictionary<string, CLRVersion>();

            expected.Add(Constants.Version20Full, CLRVersions.Versions[Constants.Version20Full]);
            expected.Add(Constants.Version30Full, CLRVersions.Versions[Constants.Version30Full]);
            expected.Add(Constants.Version35SP1Full, CLRVersions.Versions[Constants.Version35SP1Full]);
            expected.Add(Constants.Version40Client, CLRVersions.Versions[Constants.Version40Client]);
            expected.Add(Constants.Version40Full, CLRVersions.Versions[Constants.Version40Full]);

            var CLRVersionFac = new CLRVersions(UserAgent);
            var actual = CLRVersionFac.GetInstalledVersions();

            CollectionAssert.AreEquivalent((ICollection)expected, (ICollection)actual);

            var expectedLatestVersion = CLRVersions.Versions[Constants.Version40Full];
            var actualLatestVersion = CLRVersionFac.GetLatestVersion();
            Assert.IsTrue(actualLatestVersion != null, "Version is not null");

            Assert.AreEqual(expectedLatestVersion.Major, actualLatestVersion.Major, "Major Versions Are the Same");
            Assert.AreEqual(expectedLatestVersion.Minor, actualLatestVersion.Minor, "Minor Versions Are the Same");
            Assert.AreEqual(expectedLatestVersion.Profile, actualLatestVersion.Profile, "Profile is the Same");
            Assert.AreEqual(expectedLatestVersion.ServicePack, actualLatestVersion.ServicePack, "Service Pack is the Same");
        }
Beispiel #2
0
        /// <summary>
        /// Writes a Json String Containing Download Information for all of the .NET CLR Versions
        /// </summary>
        /// <returns>A Json String</returns>
        public static string WriteDownloads()
        {
            if (_downloadString == "")
            {
                var DownloadableVersions = CLRVersions.GetDownloadableVersions().Select(p => JsonVersions.WriteVersionWithDownload(p.Value)).ToList();

                _downloadString = String.Format(@"SmallestDotNet.downloadableVersions = [{0}];", String.Join(",", DownloadableVersions.ToArray()));
            }

            return(_downloadString);
        }
Beispiel #3
0
    public static string GetJsonPayload(String UserAgent)
    {
        var OperatingSystem = OperatingSystems.GetOperatingSystem(UserAgent);
        if (OperatingSystem.LatestCLRVersion != null)
        {
            var Browser = BrowserSupport.GetBrowser(UserAgent);

            if (Browser.CanGetCLRVersion)
            {
                var parsedVersions = new CLRVersions(UserAgent);

                var LatestVersion = parsedVersions.GetLatestVersion();

                var UpToDate = (LatestVersion == OperatingSystem.LatestCLRVersion);
            }
        }

        return "Not Implemented";
    }