TransformFile() public method

Transform a windows file name according to the Zip file naming conventions.
public TransformFile ( string name ) : string
name string The file name to transform.
return string
Exemplo n.º 1
0
        public void NameTransforms()
        {
            INameTransform t = new ZipNameTransform(@"C:\Slippery");
            Assert.AreEqual("Pongo/Directory/", t.TransformDirectory(@"C:\Slippery\Pongo\Directory"), "Value should be trimmed and converted");
            Assert.AreEqual("PoNgo/Directory/", t.TransformDirectory(@"c:\slipperY\PoNgo\Directory"), "Trimming should be case insensitive");
            Assert.AreEqual("slippery/Pongo/Directory/", t.TransformDirectory(@"d:\slippery\Pongo\Directory"), "Trimming should be case insensitive");

            Assert.AreEqual("Pongo/File", t.TransformFile(@"C:\Slippery\Pongo\File"), "Value should be trimmed and converted");
        }
Exemplo n.º 2
0
        public void PathalogicalNames()
        {
            string badName = ".*:\\zy3$";

            Assert.IsFalse(ZipNameTransform.IsValidName(badName));

            ZipNameTransform t = new ZipNameTransform();
            string result = t.TransformFile(badName);

            Assert.IsTrue(ZipNameTransform.IsValidName(result));
        }
Exemplo n.º 3
0
 void TestFile(ZipNameTransform t, string original, string expected)
 {
     string transformed = t.TransformFile(original);
     Assert.AreEqual(expected, transformed, "Should be equal");
 }