diff --git a/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/DeploymentTests.cs b/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/DeploymentTests.cs index d8e63758fe..a37e8041d6 100644 --- a/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/DeploymentTests.cs +++ b/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/DeploymentTests.cs @@ -53,4 +53,16 @@ public void ValidateDirectoryDeployment(string targetFramework) InvokeVsTestForExecution(new string[] { TestAssetPreserveNewest }, testCaseFilter: "DirectoryDeploymentTests", targetFramework: targetFramework); ValidatePassedTestsContain("DeploymentTestProject.PreserveNewest.DirectoryDeploymentTests.DirectoryWithForwardSlash", "DeploymentTestProject.PreserveNewest.DirectoryDeploymentTests.DirectoryWithBackSlash"); } + + public void ValidateFileDeployment_net462() + => ValidateFileDeployment("net462"); + + public void ValidateFileDeployment_netcoreapp31() + => ValidateFileDeployment("netcoreapp3.1"); + + public void ValidateFileDeployment(string targetFramework) + { + InvokeVsTestForExecution(new string[] { TestAssetPreserveNewest }, testCaseFilter: "FileDeploymentTests", targetFramework: targetFramework); + ValidatePassedTestsContain("DeploymentTestProject.PreserveNewest.FileDeploymentTests.FileWithForwardSlash", "DeploymentTestProject.PreserveNewest.FileDeploymentTests.FileWithBackSlash"); + } } diff --git a/test/IntegrationTests/TestAssets/DeploymentTestProject.PreserveNewest/FileDeploymentTests.cs b/test/IntegrationTests/TestAssets/DeploymentTestProject.PreserveNewest/FileDeploymentTests.cs new file mode 100644 index 0000000000..e143dc0c0c --- /dev/null +++ b/test/IntegrationTests/TestAssets/DeploymentTestProject.PreserveNewest/FileDeploymentTests.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.IO; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace DeploymentTestProject.PreserveNewest; +[TestClass] +public class FileDeploymentTests +{ + [TestMethod] + [DeploymentItem(@"TestFiles1/some_file1")] + public void FileWithForwardSlash() + { + var fs = File.Open(@"some_file1", FileMode.Open); + fs.Close(); + } + + [TestMethod] + [DeploymentItem(@"TestFiles2\some_file2")] + public void FileWithBackSlash() + { + var fs = File.Open(@"some_file2", FileMode.Open); + fs.Close(); + } +}