Пример #1
0
        public void CreateDirectoryShortcut_FileExists()
        {
            using (var targetPath = new SIL.TestUtilities.TemporaryFolder(Path.GetRandomFileName()))
                using (var directory = new SIL.TestUtilities.TemporaryFolder(Path.GetRandomFileName()))
                {
                    var existingDestination = new SIL.TestUtilities.TempFileFromFolder(directory,
                                                                                       Path.GetFileName(targetPath.Path) + ".lnk", string.Empty);

                    ShortcutMaker.CreateDirectoryShortcut(targetPath.Path, directory.Path);

                    var expectedFile = Path.Combine(directory.Path, Path.GetFileName(targetPath.Path)) + ".lnk";
                    Assert.That(File.GetAttributes(expectedFile) & (FileAttributes.Directory | FileAttributes.Normal), Is.Not.Null);
                    Assert.That(ResolveShortcut.Resolve(expectedFile), Is.EqualTo(targetPath.Path));
                }
        }
Пример #2
0
        public void CreateDirectoryShortcut_FileExists()
        {
            using (var targetPath = new SIL.TestUtilities.TemporaryFolder(Path.GetRandomFileName()))
            using (var directory = new SIL.TestUtilities.TemporaryFolder(Path.GetRandomFileName()))
            {
                var existingDestination = new SIL.TestUtilities.TempFileFromFolder(directory,
                    Path.GetFileName(targetPath.Path) + ".lnk", string.Empty);

                ShortcutMaker.CreateDirectoryShortcut(targetPath.Path, directory.Path);

                var expectedFile = Path.Combine(directory.Path, Path.GetFileName(targetPath.Path)) + ".lnk";
                Assert.That(File.GetAttributes(expectedFile) & (FileAttributes.Directory | FileAttributes.Normal), Is.Not.Null);
                Assert.That(ResolveShortcut.Resolve(expectedFile), Is.EqualTo(targetPath.Path));
            }
        }