private void AlphaFS_BackupFileStream_FilePortionIsLocked_ThrowsIOException(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var file = tempRoot.CreateFile();

                Console.WriteLine("Input File Path: [{0}]", file.FullName);


                using (var bfs = new Alphaleonis.Win32.Filesystem.BackupFileStream(file.FullName, System.IO.FileMode.Open))
                    try
                    {
                        bfs.ReadStreamInfo();

                        bfs.Lock(0, 10);

                        UnitTestAssert.ThrowsException <System.IO.IOException>(() => bfs.Lock(0, 10));
                    }
                    finally
                    {
                        bfs.Unlock(0, 10);
                    }
            }

            Console.WriteLine();
        }
        public void AlphaFS_Volume_DefineDosDevice_SymbolicLinkDriveMapping(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var folder = tempRoot.CreateDirectory();
                var drive  = string.Format(CultureInfo.InvariantCulture, @"{0}:\", Alphaleonis.Win32.Filesystem.DriveInfo.GetFreeDriveLetter(true));

                Assert.IsFalse(System.IO.Directory.Exists(drive), "The drive exists, but it is expected not to.");


                try
                {
                    Alphaleonis.Win32.Filesystem.Volume.DefineDosDevice(drive, folder.FullName, Alphaleonis.Win32.Filesystem.DosDeviceAttributes.RawTargetPath);


                    // Remove Symbolic Link, no exact match: fail.

                    UnitTestAssert.ThrowsException <System.IO.FileNotFoundException>(() => Alphaleonis.Win32.Filesystem.Volume.DeleteDosDevice(drive, folder.FullName));
                }
                finally
                {
                    // Remove Symbolic Link, exact match: success.

                    Alphaleonis.Win32.Filesystem.Volume.DeleteDosDevice(drive, folder.FullName, true);

                    Assert.IsFalse(System.IO.Directory.Exists(drive), "The drive exists, but it is expected not to.");
                }
            }

            Console.WriteLine();
        }
コード例 #3
0
        public void AlphaFS_File_SetTimestampsOnSymbolicLink_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            AlphaFS_File_SetTimestampsOnSymbolicLink(false);
            AlphaFS_File_SetTimestampsOnSymbolicLink(true);
        }
コード例 #4
0
        public void AlphaFS_Host_EnumerateSessions_Local_Success()
        {
            UnitTestConstants.PrintUnitTestHeader(false);

            var host = Environment.MachineName;

            Console.WriteLine("Input Host: [{0}]", host);


            var sessionCount = 0;

            foreach (var sessionsInfo in Alphaleonis.Win32.Network.Host.EnumerateSessions(host))
            {
                //Console.WriteLine("\n\t#{0:000}\tShare: [{1}]", ++cnt, shareInfo);

                UnitTestConstants.Dump(sessionsInfo);

                Assert.IsNotNull(sessionsInfo);

                sessionCount++;

                Console.WriteLine();
            }


            if (sessionCount == 0)
            {
                UnitTestAssert.InconclusiveBecauseResourcesAreUnavailable();
            }
        }
コード例 #5
0
        public void AlphaFS_Directory_Copy_SymbolicLink_SourceIsASymbolicLink_TargetMustAlsoBeASymbolicLink_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            AlphaFS_Directory_Copy_SymbolicLink_SourceIsASymbolicLink_TargetMustAlsoBeASymbolicLink(false);
            AlphaFS_Directory_Copy_SymbolicLink_SourceIsASymbolicLink_TargetMustAlsoBeASymbolicLink(true);
        }
コード例 #6
0
        private void AlphaFS_Directory_Delete_ThrowsDeviceNotReadyException_NonExistingLogicalDrive(bool isNetwork)
        {
            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var nonExistingDriveLetter = Alphaleonis.Win32.Filesystem.DriveInfo.GetFreeDriveLetter();

            var folder = nonExistingDriveLetter + @":\NonExisting Source Folder";

            if (isNetwork)
            {
                folder = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(folder);
            }

            Console.WriteLine("Input Directory Path: [{0}]", folder);


            if (isNetwork)
            {
                UnitTestAssert.ThrowsException <System.IO.IOException>(() => System.IO.Directory.Delete(folder));

                UnitTestAssert.ThrowsException <Alphaleonis.Win32.Filesystem.DeviceNotReadyException>(() => Alphaleonis.Win32.Filesystem.Directory.Delete(folder));
            }

            else
            {
                UnitTestAssert.ThrowsException <System.IO.DirectoryNotFoundException>(() => System.IO.Directory.Delete(folder));

                UnitTestAssert.ThrowsException <Alphaleonis.Win32.Filesystem.DeviceNotReadyException>(() => Alphaleonis.Win32.Filesystem.Directory.Delete(folder));
            }

            Console.WriteLine();
        }
コード例 #7
0
        public void AlphaFS_Volume_EnumerateVolumes_Local_Success()
        {
            UnitTestConstants.PrintUnitTestHeader(false);

            Console.WriteLine("Should give the same (or more) enumeration as \"mountvol.exe\"\n");


            var volumeCount = 0;

            foreach (var volume in Alphaleonis.Win32.Filesystem.Volume.EnumerateVolumes())
            {
                Console.WriteLine("#{0:000}\tVolume: [{1}]", ++volumeCount, volume);
                Console.WriteLine();


                foreach (var displayName in Alphaleonis.Win32.Filesystem.Volume.EnumerateVolumePathNames(volume))
                {
                    Console.WriteLine("\t\tVolume points to logcal drive: [{0}]", displayName);
                    Console.WriteLine();
                }


                Console.WriteLine();
            }


            if (volumeCount == 0)
            {
                UnitTestAssert.InconclusiveBecauseEnumerationIsEmpty();
            }
        }
        private void AlphaFS_File_Move_NonExistingDestinationLogicalDrive_ThrowsDeviceNotReadyException(bool isNetwork)
        {
            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var nonExistingDriveLetter = Alphaleonis.Win32.Filesystem.DriveInfo.GetFreeDriveLetter();

            var srcFile = UnitTestConstants.SysDrive + @"\NonExisting Source File";
            var dstFile = nonExistingDriveLetter + @":\NonExisting Destination File";

            if (isNetwork)
            {
                srcFile = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(srcFile);
                dstFile = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(dstFile);
            }

            Console.WriteLine("Src File Path: [{0}]", srcFile);
            Console.WriteLine("Dst File Path: [{0}]", dstFile);


            UnitTestAssert.ThrowsException <System.IO.FileNotFoundException>(() => System.IO.File.Move(srcFile, dstFile));

            UnitTestAssert.ThrowsException <Alphaleonis.Win32.Filesystem.DeviceNotReadyException>(() => Alphaleonis.Win32.Filesystem.File.Move(srcFile, dstFile));

            Assert.IsFalse(System.IO.Directory.Exists(dstFile), "The file exists, but is expected not to.");

            Console.WriteLine();
        }
コード例 #9
0
        public void File_Create_WithFileSecurity_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            File_Create_WithFileSecurity(false);
            File_Create_WithFileSecurity(true);
        }
        private void AlphaFS_Directory_GetFileSystemEntryInfo_ThrowDirectoryNotFoundException_FileExistsWithSameNameAsDirectory(bool isNetwork)
        {
            var path = System.IO.Path.Combine(Environment.SystemDirectory, "notepad.exe");

            if (!System.IO.File.Exists(path))
            {
                UnitTestAssert.InconclusiveBecauseFileNotFound(path);
            }


            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var tempPath = path;

            if (isNetwork)
            {
                tempPath = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(tempPath);
            }

            Console.WriteLine("Input Directory Path: [{0}]", tempPath);

            ExceptionAssert.DirectoryNotFoundException(() => Alphaleonis.Win32.Filesystem.Directory.GetFileSystemEntryInfo(tempPath));

            Console.WriteLine();
        }
コード例 #11
0
        public void AlphaFS_Host_EnumerateNetworks_Local_Success()
        {
            UnitTestConstants.PrintUnitTestHeader(false);


            var networkCount = 0;

            foreach (var networkInfo in Host.EnumerateNetworks().OrderBy(network => network.Name))
            {
                Console.WriteLine("#{0:000}\tNetwork: [{1}]", ++networkCount, networkInfo.Name);


                UnitTestConstants.Dump(networkInfo);


                if (null != networkInfo.Connections)
                {
                    foreach (var connectionInfo in networkInfo.Connections)
                    {
                        UnitTestConstants.Dump(connectionInfo.NetworkInterface, true);
                    }
                }


                Console.WriteLine();
            }


            if (networkCount == 0)
            {
                UnitTestAssert.InconclusiveBecauseResourcesAreUnavailable();
            }
        }
コード例 #12
0
        private void AlphaFS_DirectoryInfo_MoveTo_DelayUntilReboot(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var folder = Alphaleonis.Win32.Filesystem.Directory.CreateDirectory(tempRoot.RandomDirectoryFullPath);

                var pendingEntry = folder.FullName;

                Console.WriteLine("Src Directory Path: [{0}]", pendingEntry);


                if (isNetwork)
                {
                    // Trigger DelayUntilReboot.
                    UnitTestAssert.ThrowsException <ArgumentException>(() => folder.MoveTo(null, Alphaleonis.Win32.Filesystem.MoveOptions.DelayUntilReboot));
                }

                else
                {
                    // Trigger DelayUntilReboot.
                    folder.MoveTo(null, Alphaleonis.Win32.Filesystem.MoveOptions.DelayUntilReboot);


                    UnitTestAssert.RegistryContainsPendingEntry(pendingEntry);
                }
            }

            Console.WriteLine();
        }
        public void AlphaFS_File_Move_DelayUntilReboot_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            AlphaFS_File_Move_DelayUntilReboot(false);
            AlphaFS_File_Move_DelayUntilReboot(true);
        }
コード例 #14
0
        public void AlphaFS_Directory_SetTimestamps_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            AlphaFS_Directory_SetTimestamps(false);
            AlphaFS_Directory_SetTimestamps(true);
        }
コード例 #15
0
        private void EnumerateOpenConnections(string host, string share)
        {
            //UnitTestAssert.IsElevatedProcess(); // In User mode nothing is enumerated.
            UnitTestConstants.PrintUnitTestHeader(false);

            Console.WriteLine("Connected to Share: [{0}\\{1}]", host, share);


            var count = 0;

            foreach (var openConnectionInfo in Alphaleonis.Win32.Network.Host.EnumerateOpenConnections(host, share, true))
            {
                UnitTestConstants.Dump(openConnectionInfo);

                Assert.IsNotNull(openConnectionInfo);

                count++;

                Console.WriteLine();
            }


            if (count == 0)
            {
                UnitTestAssert.InconclusiveBecauseEnumerationIsEmpty();
            }
        }
コード例 #16
0
        public void AlphaFS_Host_EnumerateShares_Local_Success()
        {
            UnitTestConstants.PrintUnitTestHeader(false);

            var host = Environment.MachineName;

            Console.WriteLine("Input Host: [{0}]", host);


            var count = 0;

            foreach (var shareInfo in Alphaleonis.Win32.Network.Host.EnumerateShares(host, true))
            {
                if (UnitTestConstants.Dump(shareInfo, -18))
                {
                    count++;
                }

                Console.WriteLine();
            }

            if (count == 0)
            {
                UnitTestAssert.InconclusiveBecauseEnumerationIsEmpty();
            }
        }
        public void AlphaFS_Directory_CreateSymbolicLink_And_GetLinkTargetInfo_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            AlphaFS_Directory_CreateSymbolicLink_And_GetLinkTargetInfo(false);
            AlphaFS_Directory_CreateSymbolicLink_And_GetLinkTargetInfo(true);
        }
        private void Directory_Delete_DirectoryHasDenyPermission_ThrowsUnauthorizedAccessException(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var folder = System.IO.Directory.CreateDirectory(System.IO.Path.Combine(tempRoot.Directory.FullName, "Existing Source Folder"));

                Console.WriteLine("Input Directory Path: [{0}]", folder);

                // Set DENY permission for current user.
                tempRoot.SetDirectoryDenyPermission(true, folder.FullName);

                try
                {
                    UnitTestAssert.ThrowsException <System.IO.IOException>(() => System.IO.Directory.Delete(folder.FullName));


                    // 2018-05-29 BUG: Throws wrong Exception.
                    UnitTestAssert.ThrowsException <UnauthorizedAccessException>(() => Alphaleonis.Win32.Filesystem.Directory.Delete(folder.FullName));
                }
                finally
                {
                    // Remove DENY permission for current user.
                    tempRoot.SetDirectoryDenyPermission(false, folder.FullName);
                }
            }

            Console.WriteLine();
        }
        private void File_Move_NonExistingSourceDirectory_ThrowsDirectoryNotFoundException(bool isNetwork)
        {
            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var srcFolder = UnitTestConstants.SysDrive + @"\NonExisting Source Folder\NonExisting Source File";
            var dstFolder = UnitTestConstants.SysDrive + @"\NonExisting Destination Folder\NonExisting Destination File";

            if (isNetwork)
            {
                srcFolder = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(srcFolder);
                dstFolder = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(dstFolder);
            }

            Console.WriteLine("Src File Path: [{0}]", srcFolder);
            Console.WriteLine("Dst File Path: [{0}]", dstFolder);


            UnitTestAssert.ThrowsException <System.IO.FileNotFoundException>(() => System.IO.File.Move(srcFolder, dstFolder), srcFolder);


            // 2018-05-29 BUG: Throws wrong Exception.
            UnitTestAssert.ThrowsException <System.IO.DirectoryNotFoundException>(() => Alphaleonis.Win32.Filesystem.File.Move(srcFolder, dstFolder), srcFolder);


            Console.WriteLine();
        }
コード例 #20
0
        public void AlphaFS_Host_EnumerateShares_Local_Success()
        {
            UnitTestConstants.PrintUnitTestHeader(false);

            var host = Environment.MachineName;

            Console.WriteLine("Input Host: [{0}]", host);


            var count = 0;

            foreach (var shareInfo in Alphaleonis.Win32.Network.Host.EnumerateShares(host, true))
            {
                UnitTestConstants.Dump(shareInfo);

                Assert.IsNotNull(shareInfo);

                count++;

                Console.WriteLine();
            }

            if (count == 0)
            {
                UnitTestAssert.InconclusiveBecauseResourcesAreUnavailable();
            }
        }
コード例 #21
0
        private void AlphaFS_File_Move_Overwrite_DestinationFileAlreadyExists(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var fileSource = tempRoot.CreateFile();
                var fileCopy   = tempRoot.CreateFile();

                Console.WriteLine("Source File Path: [{0}]", fileSource.FullName);


                UnitTestAssert.ThrowsException <System.IO.IOException>(() => System.IO.File.Move(fileSource.FullName, fileCopy.FullName));

                UnitTestAssert.ThrowsException <Alphaleonis.Win32.Filesystem.AlreadyExistsException>(() => Alphaleonis.Win32.Filesystem.File.Move(fileSource.FullName, fileCopy.FullName));


                Alphaleonis.Win32.Filesystem.File.Move(fileSource.FullName, fileCopy.FullName, Alphaleonis.Win32.Filesystem.MoveOptions.ReplaceExisting);


                Assert.IsFalse(System.IO.File.Exists(fileSource.FullName), "The file does exists, but is expected not to.");

                Assert.IsTrue(System.IO.File.Exists(fileCopy.FullName), "The file does not exists, but is expected to.");
            }

            Console.WriteLine();
        }
コード例 #22
0
        private void AlphaFS_File_GetFileSystemEntryInfo(bool isNetwork)
        {
            var path = System.IO.Path.Combine(Environment.SystemDirectory, "notepad.exe");

            if (!System.IO.File.Exists(path))
            {
                UnitTestAssert.InconclusiveBecauseFileNotFound(path);
            }


            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var tempPath = path;

            if (isNetwork)
            {
                tempPath = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(tempPath);
            }

            Console.WriteLine("Input File Path: [{0}]", tempPath);

            var fsei = Alphaleonis.Win32.Filesystem.File.GetFileSystemEntryInfo(tempPath);

            UnitTestConstants.Dump(fsei, -19);

            Assert.IsTrue(fsei.GetType().IsEquivalentTo(typeof(Alphaleonis.Win32.Filesystem.FileSystemEntryInfo)));
            Assert.IsTrue(fsei.Attributes != System.IO.FileAttributes.Directory, "The directory attribute is found, but is not expected.");
            Assert.AreEqual(tempPath, fsei.FullPath, "The paths are not equal, but are expected to be.");

            Console.WriteLine();
        }
コード例 #23
0
        private void AlphaFS_Directory_Move_NonExistingSourceLogicalDrive_ThrowsDeviceNotReadyException(bool isNetwork)
        {
            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var nonExistingDriveLetter = Alphaleonis.Win32.Filesystem.DriveInfo.GetFreeDriveLetter();

            var srcFolder = nonExistingDriveLetter + @":\NonExisting Source Folder";
            var dstFolder = UnitTestConstants.SysDrive + @"\NonExisting Destination Folder";

            if (isNetwork)
            {
                srcFolder = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(srcFolder);
                dstFolder = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(dstFolder);
            }

            Console.WriteLine("Src Directory Path: [{0}]", srcFolder);
            Console.WriteLine("Dst Directory Path: [{0}]", dstFolder);


            UnitTestAssert.ThrowsException <Alphaleonis.Win32.Filesystem.DeviceNotReadyException>(() => Alphaleonis.Win32.Filesystem.Directory.Move(srcFolder, dstFolder, Alphaleonis.Win32.Filesystem.MoveOptions.CopyAllowed));

            Assert.IsFalse(System.IO.Directory.Exists(dstFolder), "The directory exists, but is expected not to.");

            Console.WriteLine();
        }
コード例 #24
0
        public void File_SetAccessControl_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            File_SetAccessControl(false);
            File_SetAccessControl(true);
        }
コード例 #25
0
        public void AlphaFS_Host_EnumerateOpenResources_Local_Success()
        {
            UnitTestAssert.IsElevatedProcess();
            UnitTestConstants.PrintUnitTestHeader(false);

            var host = Environment.MachineName;

            Console.WriteLine("Connected to Host: [{0}]", host);


            var count = 0;

            foreach (var openResourceInfo in Alphaleonis.Win32.Network.Host.EnumerateOpenResources(host, null, null, false))
            {
                UnitTestConstants.Dump(openResourceInfo);

                Assert.IsNotNull(openResourceInfo);

                count++;

                Console.WriteLine();
            }


            if (count == 0)
            {
                UnitTestAssert.InconclusiveBecauseEnumerationIsEmpty();
            }
        }
コード例 #26
0
        private void AlphaFS_Directory_CreateDirectory_NonExistingDriveLetter_ThrowsIOExceptionOrDeviceNotReadyException(bool isNetwork)
        {
            UnitTestConstants.PrintUnitTestHeader(isNetwork);

            var folder = Alphaleonis.Win32.Filesystem.DriveInfo.GetFreeDriveLetter() + @":\NonExistingDriveLetter";

            if (isNetwork)
            {
                folder = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(folder);
            }

            Console.WriteLine("Input Directory Path: [{0}]", folder);


            UnitTestAssert.ThrowsException <System.IO.IOException>(() => System.IO.Directory.CreateDirectory(folder));


            // Local: IOException.
            // UNC: IOException or DeviceNotReadyException.
            // The latter occurs when a removable drive is already removed but there's still a cached reference.

            var caught = UnitTestAssert.TestException <System.IO.IOException>(() => Alphaleonis.Win32.Filesystem.Directory.CreateDirectory(folder));

            if (!caught)
            {
                caught = UnitTestAssert.TestException <Alphaleonis.Win32.Filesystem.DeviceNotReadyException>(() => Alphaleonis.Win32.Filesystem.Directory.CreateDirectory(folder));
            }


            Assert.IsTrue(caught);

            Console.WriteLine();
        }
コード例 #27
0
        public void AlphaFS_Host_EnumerateNetworkConnections_Local_Success()
        {
            UnitTestConstants.PrintUnitTestHeader(false);


            var networkConnectionCount = 0;

            foreach (var networkConnection in Host.EnumerateNetworkConnections().OrderBy(networkConnection => networkConnection.NetworkInfo.Name))
            {
                Console.WriteLine("#{0:000}\tNetwork: [{1}]", ++networkConnectionCount, networkConnection.NetworkInfo.Name);


                UnitTestConstants.Dump(networkConnection, -21);

                UnitTestConstants.Dump(networkConnection.NetworkInfo, -21, true);

                UnitTestConstants.Dump(networkConnection.NetworkInterface, -20, true);


                Console.WriteLine();
            }


            if (networkConnectionCount == 0)
            {
                UnitTestAssert.InconclusiveBecauseEnumerationIsEmpty();
            }
        }
コード例 #28
0
        private void DirectoryInfo_InitializeInstance_FolderNameGreaterThan255Characters_ThrowsPathTooLongException(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var folder = tempRoot.Directory.FullName;

                Console.WriteLine("Input Directory Path: [{0}]", folder);


                // System.IO: 244, anything higher throws System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
                // AlphaFS  : 255, anything higher throws System.IO.PathTooLongException.
                var subFolder = new string('b', 256);


                var local = Alphaleonis.Win32.Filesystem.Path.Combine(folder, subFolder);
                var unc   = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(local);
                Console.WriteLine("SubFolder length: {0}, total path length: {1}", subFolder.Length, isNetwork ? unc.Length : local.Length);
                Console.WriteLine();


                UnitTestAssert.ThrowsException <System.IO.PathTooLongException>(() => new System.IO.DirectoryInfo(isNetwork ? unc : local));

                UnitTestAssert.ThrowsException <System.IO.PathTooLongException>(() => new Alphaleonis.Win32.Filesystem.DirectoryInfo(isNetwork ? unc : local));
            }

            Console.WriteLine();
        }
        private void AlphaFS_File_Copy_Overwrite_DestinationFileAlreadyExists(bool isNetwork)
        {
            using (var tempRoot = new TemporaryDirectory(isNetwork))
            {
                var srcFile = tempRoot.CreateFile();
                var dstFile = tempRoot.CreateFile();

                Console.WriteLine("Src File Path: [{0}]", srcFile.FullName);
                Console.WriteLine("Dst File Path: [{0}]", dstFile.FullName);


                UnitTestAssert.ThrowsException <System.IO.IOException>(() => System.IO.File.Copy(srcFile.FullName, dstFile.FullName));

                UnitTestAssert.ThrowsException <Alphaleonis.Win32.Filesystem.AlreadyExistsException>(() => Alphaleonis.Win32.Filesystem.File.Copy(srcFile.FullName, dstFile.FullName));


                Alphaleonis.Win32.Filesystem.File.Copy(srcFile.FullName, dstFile.FullName, true);


                Assert.IsTrue(System.IO.File.Exists(srcFile.FullName), "The file does not exists, but is expected to.");

                Assert.IsTrue(System.IO.File.Exists(dstFile.FullName), "The file does not exists, but is expected to.");
            }

            Console.WriteLine();
        }
コード例 #30
0
        public void Directory_CreateDirectory_WithDirectorySecurity_LocalAndNetwork_Success()
        {
            UnitTestAssert.IsElevatedProcess();

            Directory_CreateDirectory_WithDirectorySecurity(false);
            Directory_CreateDirectory_WithDirectorySecurity(true);
        }