Exemple #1
0
        public void IsAbsolutePath_Unix()
        {
            var pal = new UnixPAL();

            Assert(!pal.IsAbsolutePath(null));
            Assert(!pal.IsAbsolutePath(""));
            Assert(!pal.IsAbsolutePath("C"));
            Assert(!pal.IsAbsolutePath(@":"));
            Assert(!pal.IsAbsolutePath(@"XX:"));

            // root
            Assert(pal.IsAbsolutePath(@"\"));
            Assert(pal.IsAbsolutePath(@"/"));
            Assert(pal.IsAbsolutePath(@"\:"));
            Assert(pal.IsAbsolutePath(@"/:"));
            Assert(pal.IsAbsolutePath(@"\/"));
            Assert(pal.IsAbsolutePath(@"\\"));
            Assert(pal.IsAbsolutePath(@"/\"));
            Assert(pal.IsAbsolutePath(@"//"));

            // current working directory relative
            Assert(!pal.IsAbsolutePath(@"."));
            Assert(!pal.IsAbsolutePath(@".\"));
            Assert(!pal.IsAbsolutePath(@"./"));
            Assert(!pal.IsAbsolutePath(@".."));
            Assert(!pal.IsAbsolutePath(@"..\"));
            Assert(!pal.IsAbsolutePath(@"../"));

            // Drive relative
            Assert(!pal.IsAbsolutePath(@"C:"));

            // Drive
            Assert(!pal.IsAbsolutePath(@"C:\"));
            Assert(!pal.IsAbsolutePath(@"C:/"));
            Assert(!pal.IsAbsolutePath(@"C:\path"));

            // relative to the current user:
            Assert(!pal.IsAbsolutePath(@"~\path"));
        }
        public void IsAbsolutePath_Unix()
        {
            var pal = new UnixPAL();

            Assert(!pal.IsAbsolutePath(null));
            Assert(!pal.IsAbsolutePath(""));
            Assert(!pal.IsAbsolutePath("C"));
            Assert(!pal.IsAbsolutePath(@":"));
            Assert(!pal.IsAbsolutePath(@"XX:"));

            // root
            Assert(pal.IsAbsolutePath(@"\"));
            Assert(pal.IsAbsolutePath(@"/"));
            Assert(pal.IsAbsolutePath(@"\:"));
            Assert(pal.IsAbsolutePath(@"/:"));
            Assert(pal.IsAbsolutePath(@"\/"));
            Assert(pal.IsAbsolutePath(@"\\"));
            Assert(pal.IsAbsolutePath(@"/\"));
            Assert(pal.IsAbsolutePath(@"//"));

            // current working directory relative
            Assert(!pal.IsAbsolutePath(@"."));
            Assert(!pal.IsAbsolutePath(@".\"));
            Assert(!pal.IsAbsolutePath(@"./"));
            Assert(!pal.IsAbsolutePath(@".."));
            Assert(!pal.IsAbsolutePath(@"..\"));
            Assert(!pal.IsAbsolutePath(@"../"));

            // Drive relative
            Assert(!pal.IsAbsolutePath(@"C:"));

            // Drive
            Assert(!pal.IsAbsolutePath(@"C:\"));
            Assert(!pal.IsAbsolutePath(@"C:/"));
            Assert(!pal.IsAbsolutePath(@"C:\path"));

            // relative to the current user:
            Assert(!pal.IsAbsolutePath(@"~\path"));
        }