Ejemplo n.º 1
0
        public void MakeLinkMultiple()
        {
            var list = new SharesList();

            list.AddOrReplace(UnixShare("share1", "/home/user/share1"));
            list.AddOrReplace(UnixShare("share2", "/home/user/share2"));
            {
                var localPath = UnixPath("/home/user/share1/test.txt");
                Assert.AreEqual("/home/user/share1/test.txt", LinkMaker.MakeLink(LinkFormat.LocalPath, "host", list, localPath, '/'));
                Assert.AreEqual("file:///home/user/share1/test.txt", LinkMaker.MakeLink(LinkFormat.LocalFile, "host", list, localPath, '/'));
                Assert.AreEqual("file://host/share1/test.txt", LinkMaker.MakeLink(LinkFormat.File, "host", list, localPath, '/'));
                Assert.AreEqual(@"\\host\share1\test.txt", LinkMaker.MakeLink(LinkFormat.Unc, "host", list, localPath, '/'));
                Assert.AreEqual(@"\\host\share1\test.txt", LinkMaker.MakeLink(LinkFormat.UncEscaped, "host", list, localPath, '/'));
                Assert.AreEqual("smb://host/share1/test.txt", LinkMaker.MakeLink(LinkFormat.Smb, "host", list, localPath, '/'));
            }

            {
                var localPath = UnixPath("/home/user/share2/test.txt");
                Assert.AreEqual("/home/user/share2/test.txt", LinkMaker.MakeLink(LinkFormat.LocalPath, "host", list, localPath, '/'));
                Assert.AreEqual("file:///home/user/share2/test.txt", LinkMaker.MakeLink(LinkFormat.LocalFile, "host", list, localPath, '/'));
                Assert.AreEqual("file://host/share2/test.txt", LinkMaker.MakeLink(LinkFormat.File, "host", list, localPath, '/'));
                Assert.AreEqual(@"\\host\share2\test.txt", LinkMaker.MakeLink(LinkFormat.Unc, "host", list, localPath, '/'));
                Assert.AreEqual(@"\\host\share2\test.txt", LinkMaker.MakeLink(LinkFormat.UncEscaped, "host", list, localPath, '/'));
                Assert.AreEqual("smb://host/share2/test.txt", LinkMaker.MakeLink(LinkFormat.Smb, "host", list, localPath, '/'));
            }
        }
Ejemplo n.º 2
0
        public void MakeLinkCaseInsensitive()
        {
            var list = new SharesList(false);

            list.AddOrReplace(WindowsShare("share", "c:\\downloads"));
            Assert.AreEqual(@"\\host\share\test.txt", LinkMaker.MakeLink(LinkFormat.Unc, "host", list, WindowsPath(@"c:\Downloads\test.txt"), '\\'));
            Assert.AreEqual(@"\\host\share\test.txt", LinkMaker.MakeLink(LinkFormat.Unc, "host", list, WindowsPath(@"c:\downloads\test.txt"), '\\'));
        }