예제 #1
0
        public void TestGeneral1()
        {
            // --
            // Conversion between short and long paths.

            var lp1 = Assembly.GetEntryAssembly()?.Location;

            if (lp1 == null)
            {
                return;
            }

            var sp1 = ZlpIOHelper.ForceRemoveLongPathPrefix(ZlpPathHelper.GetShortPath(lp1));
            var lp2 = ZlpIOHelper.ForceRemoveLongPathPrefix(ZlpPathHelper.GetLongPath(sp1));
            var sp2 = ZlpIOHelper.ForceRemoveLongPathPrefix(ZlpPathHelper.GetShortPath(lp2));

            Assert.AreEqual(lp1.ToLower(), lp2.ToLower());
            Assert.AreEqual(sp1.ToLower(), sp2.ToLower());

            // --
            // Getting file sizes for short and long paths.

            var lengthA1 = new ZlpFileInfo(sp1).Length;
            var lengthA2 = new ZlpFileInfo(sp2).Length;

            var lengthB1 = new ZlpFileInfo(lp1).Length;
            var lengthB2 = new ZlpFileInfo(lp2).Length;

            Assert.AreEqual(lengthA1, lengthA2);
            Assert.AreEqual(lengthA1, lengthB1);
            Assert.AreEqual(lengthA1, lengthB2);
        }