testfx: `DeploymentItem` is not os-independant in combination with folders
Describe the bug
Hi,
I hope I am at the right repository for this. If not, please point me to the right one.
DeploymentItem
is not os-independant when using it with folders. The folder name must end with /
on linux and \
on windows.
Thank you.
Steps To Reproduce
Example files:
TestFiles1/some_file1
TestFiles2/some_file2
MyTests.cs
MyTests.csproj
// MyTests.cs
[TestClass]
public class MyTests
{
[TestMethod]
[DeploymentItem(@"TestFiles1/")]
public void TestFailsOnWindows()
{
var fs = File.Open(@"some_file1", FileMode.Open);
}
[TestMethod]
[DeploymentItem(@"TestFiles2\")]
public void TestFailsOnLinuxMac()
{
var fs = File.Open(@"some_file2", FileMode.Open);
}
}
<!--MyTests.csproj-->
<!--...-->
<ItemGroup>
<Content Include="TestFiles1\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestFiles2\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expected behavior
Using either \
or /
on windows, linux or mac should always work.
Actual behavior
Files are not copied to the test directory and the test fails if the wrong format is used.
Additional context
None.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
I am reopening the issue to confirm this use case is also working (the deployment item part is not well tested).
Thank you @Evangelink !
My impression was more “stressed” 😃. Thank you for your work!
No worries @smorokin and sorry if I gave the impression to be annoyed by your comment.
Hi @smorokin, I confirm that I can reproduce the issue even with version
3.0.2
.