Ejemplo n.º 1
0
        private void SetupDiskData()
        {
            int dataDiskId = int.Parse(this.platform.GetDataDiskDeviceName, CultureInfo.InvariantCulture);

            string dataDir = Path.Combine(BaseDir, "data");

            if (!Directory.Exists(dataDir))
            {
                Directory.CreateDirectory(dataDir);
            }

            if (!DiskUtil.DiskHasPartition(dataDiskId))
            {
                Logger.Info("Creating partition on drive " + dataDiskId);
                if (DiskUtil.CreatePrimaryPartition(dataDiskId, "data") != 0)
                {
                    Logger.Error("Could not create partition on drive " + dataDiskId);
                }
            }

            if (!DiskUtil.IsMountPoint(dataDir))
            {
                if (DiskUtil.MountPartition(dataDiskId, dataDir) != 0)
                {
                    Logger.Error("Could not mount disk " + dataDiskId + " to " + dataDir);
                }
            }
            SetupDataSys();
        }
Ejemplo n.º 2
0
        public void TC003_IsMountPointTest()
        {
            // Arrange
            string mountPoint = @"c:\";

            // Act
            bool isMountPoint = DiskUtil.IsMountPoint(mountPoint, false);

            // Assert
            Assert.IsTrue(isMountPoint);
        }
Ejemplo n.º 3
0
        public void TC010_IsMountPointInvalidPathTest()
        {
            // Arrange
            string mountPoint = Path.Combine(@"c:\", Guid.NewGuid().ToString());

            // Act
            bool isMountPoint = DiskUtil.IsMountPoint(mountPoint);

            // Assert
            Assert.IsFalse(isMountPoint);
        }
Ejemplo n.º 4
0
        public void TC009_IsMountPointNullPathTest()
        {
            // Arrange
            string    mountPoint   = null;
            Exception expected     = null;
            bool      isMountPoint = false;

            // Act
            try
            {
                isMountPoint = DiskUtil.IsMountPoint(mountPoint);
            }
            catch (Exception ex)
            {
                expected = ex;
            }

            // Assert
            Assert.IsFalse(isMountPoint);
            Assert.IsNotNull(expected);
            Assert.IsInstanceOfType(expected, typeof(ArgumentNullException));
        }