Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7d93250
Add mount point support to link APIs.
carlossanlop Aug 24, 2021
6f32d5a
Add junction and virtual drive tests.
carlossanlop Aug 24, 2021
51b069f
Move PrintName comment outside of if else of reparseTag check.
carlossanlop Aug 24, 2021
c88890f
Add Windows platform specific attribute to junction and virtual drive…
carlossanlop Aug 24, 2021
347da63
Revert FILE_NAME_OPENED to FILE_NAME_NORMALIZED
carlossanlop Aug 24, 2021
7ea3244
Revert addition of FILE_NAME_OPENED const.
carlossanlop Aug 24, 2021
8c96883
Remove unnecessary enumeration junction test.
carlossanlop Aug 25, 2021
3c3ac16
Rename GetNewCwdPath to ChangeCurrentDirectory
carlossanlop Aug 25, 2021
696c67b
Make Junction_ResolveLinkTarget a theory and test both resolveFinalTa…
carlossanlop Aug 25, 2021
10d7656
Shorter name for targetPath string. Typo in comment. Fix Debug.Assert.
carlossanlop Aug 25, 2021
a4642c6
Clarify test comment. Change PlatformDetection for OperatingSystem ch…
carlossanlop Aug 25, 2021
28b4138
Cleaner unit tests for virtual drive, add indirection test
carlossanlop Aug 26, 2021
5a122a3
Skip virtual drive tests in Windows Nano (subst not available). Small…
carlossanlop Aug 26, 2021
4e27fa0
Simplify Junctions tests, add indirection test
carlossanlop Aug 26, 2021
00d3227
Address test suggestions.
carlossanlop Aug 26, 2021
a1e45b1
Revert MountHelper.CreateSymbolicLink changes. Unrelated, and will be…
carlossanlop Aug 27, 2021
22ee205
Add dwReserved0 check for mount points in GetFinalLinkTarget.
carlossanlop Aug 27, 2021
628b96f
Use Yoda we don't.
carlossanlop Aug 27, 2021
128a333
Fix CI issues
jozkee Aug 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify Junctions tests, add indirection test
  • Loading branch information
carlossanlop authored and github-actions committed Aug 27, 2021
commit 4e27fa09e74efc096f956b3d04b3e7c2e9164d45

This file was deleted.

17 changes: 0 additions & 17 deletions src/libraries/System.IO.FileSystem/tests/Directory/Junctions.cs

This file was deleted.

This file was deleted.

62 changes: 62 additions & 0 deletions src/libraries/System.IO.FileSystem/tests/Junctions.Windows.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace System.IO.Tests
{
[PlatformSpecific(TestPlatforms.Windows)]
public class Junctions : BaseSymbolicLinks
{
protected DirectoryInfo CreateJunction(string junctionPath, string targetPath)
{
Assert.True(MountHelper.CreateJunction(junctionPath, targetPath));
DirectoryInfo junctionInfo = new(junctionPath);
return junctionInfo;
}

[Theory]
[InlineData(false)]
[InlineData(true)]
public void Junction_ResolveLinkTarget(bool returnFinalTarget)
{
string junctionPath = GetRandomLinkPath();
string targetPath = GetRandomDirPath();

Directory.CreateDirectory(targetPath);
DirectoryInfo junctionInfo = CreateJunction(junctionPath, targetPath);

FileSystemInfo? actualTargetInfo = junctionInfo.ResolveLinkTarget(returnFinalTarget);
Assert.True(actualTargetInfo is DirectoryInfo);
Assert.Equal(targetPath, actualTargetInfo.FullName);
Assert.Equal(targetPath, junctionInfo.LinkTarget);
}


[Theory]
[InlineData(false)]
[InlineData(true)]
public void Junction_ResolveLinkTarget_WithIndirection(bool returnFinalTarget)
{
string firstJunctionPath = GetRandomLinkPath();
string middleJunctionPath = GetRandomLinkPath();
string targetPath = GetRandomDirPath();

Directory.CreateDirectory(targetPath);
_ = CreateJunction(middleJunctionPath, targetPath);
DirectoryInfo firstJunctionInfo = CreateJunction(firstJunctionPath, middleJunctionPath);

string expectedTargetPath = returnFinalTarget ? targetPath : middleJunctionPath;

FileSystemInfo? actualTargetInfo = firstJunctionInfo.ResolveLinkTarget(returnFinalTarget);

Assert.True(actualTargetInfo is DirectoryInfo);
Assert.Equal(expectedTargetPath, actualTargetInfo.FullName);

// Always the immediate target
Assert.Equal(middleJunctionPath, firstJunctionInfo.LinkTarget);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Stat.cs" Link="Interop\Unix\System.Native\Interop.Stat.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="Base\SymbolicLinks\BaseJunctions.FileSystem.cs" />
<Compile Include="Base\SymbolicLinks\BaseSymbolicLinks.Windows.cs" />
<Compile Include="Directory\Delete.Windows.cs" />
<Compile Include="Directory\Junctions.cs" />
<Compile Include="DirectoryInfo\Junctions.cs" />
<Compile Include="FileSystemTest.Windows.cs" />
<Compile Include="FileStream\ctor_options_as.Windows.cs" />
<Compile Include="FileStream\FileStreamConformanceTests.Windows.cs" />
<Compile Include="Junctions.Windows.cs" />
<Compile Include="RandomAccess\Mixed.Windows.cs" />
<Compile Include="RandomAccess\NoBuffering.Windows.cs" />
<Compile Include="RandomAccess\SectorAlignedMemory.Windows.cs" />
Expand Down