Esempio n. 1
0
        public void GetSortedInstallVersion_FromDynamoLookUp()
        {
            var mockLookup = new Mock <IDynamoLookUp>();

            mockLookup.Setup(x => x.GetDynamoUserDataLocations()).Returns(MockUserDirectories);

            var versionList = DynamoMigratorBase.GetInstalledVersions(null, mockLookup.Object).ToList();

            VerifySortedOrder(versionList);
            Assert.AreEqual(4, versionList.Count);
            Assert.AreEqual(Path.Combine(TempFolder, "Test"), versionList[0].UserDataRoot);
            Assert.AreEqual(TempFolder, versionList[1].UserDataRoot);
        }
Esempio n. 2
0
        public void GetSortedInstalledVersions_FromDirectoryInspection()
        {
            var tempPath        = base.TempFolder;
            var uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "0.7"));

            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "0.8"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "0.0"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "1.7"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "1.8"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "1.9"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "2.0"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "-1.9"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "-2.9"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "-1.0"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "3.0"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "2.-9"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "2.-8"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "-2.-9"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "-2.-8"));
            uniqueDirectory = Directory.CreateDirectory(Path.Combine(tempPath, "-1.-9"));

            var versionList = DynamoMigratorBase.GetInstalledVersions(tempPath).ToList();

            VerifySortedOrder(versionList);

            try
            {
                DynamoMigratorBase.GetInstalledVersions("");
            }
            catch (ArgumentNullException e)
            {
                Assert.IsTrue(e.ParamName == "rootFolder");
            }

            try
            {
                DynamoMigratorBase.GetInstalledVersions(null);
            }
            catch (ArgumentNullException e)
            {
                Assert.IsTrue(e.ParamName == "rootFolder");
            }
        }