Beispiel #1
0
        public static IEnumerable FindProductInstallations(string productSearchPattern, string fileSearchPattern)
        {
            var installs = new InstalledProducts();

            installs.LookUpAndInitProducts(new InstalledProductLookUp(productSearchPattern, fileSearchPattern));

            return
                (installs.Products.Select(
                     p =>
                     new KeyValuePair <string, Tuple <int, int, int, int> >(
                         p.InstallLocation,
                         p.VersionInfo)));
        }
Beispiel #2
0
        public void GetInstalledProducts()
        {
            var products = new Dictionary <string, Tuple <int, int, int, int> >
            {
                { "A", Tuple.Create(0, 1, 2, 3) },
                { "B", Tuple.Create(0, 1, 3, 4) },
                { "C", Tuple.Create(1, 2, 3, 4) },
                { "D", Tuple.Create(1, 0, 3, 4) },
                { "E", null }
            };
            var lookUp = SetUpProductLookUp(products, null);

            var p = new InstalledProducts();

            p.LookUpAndInitProducts(lookUp);

            Assert.AreEqual("C", p.GetLatestProduct().ProductName);
            Assert.AreEqual("1.2.3.4", p.GetLatestProduct().VersionString);
            Assert.AreEqual(4, p.Products.Count());
        }