System.IO.Tests.Directory_CreateDirectory.DriveLetter_Unix C# (CSharp) Méthode

DriveLetter_Unix() private méthode

private DriveLetter_Unix ( ) : void
Résultat void
        public void DriveLetter_Unix()
        {
            // On Unix, there's no special casing for drive letters.  These may or may not be valid names, depending
            // on the file system underlying the current directory.  Unix file systems typically allow these, but,
            // for example, these names are not allowed if running on a file system mounted from a Windows machine.
            DirectoryInfo driveLetter;
            try
            {
                driveLetter = Create("C:");
            }
            catch (IOException)
            {
                return;
            }
            var current = Create(".");
            Assert.Equal("C:", driveLetter.Name);
            Assert.Equal(Path.Combine(current.FullName, "C:"), driveLetter.FullName);
            try
            {
                // If this test is inherited then it's possible this call will fail due to the "C:" directory
                // being deleted in that other test before this call. What we care about testing (proper path 
                // handling) is unaffected by this race condition.
                Directory.Delete("C:");
            }
            catch (DirectoryNotFoundException) { }
        }
Directory_CreateDirectory