зеркало из https://github.com/microsoft/testfx.git
DeploymentItem: add test for file deployment using Windows/Linux path… (#1709)
This commit is contained in:
Родитель
14b62451fb
Коммит
0ee05864fe
|
@ -53,4 +53,16 @@ public class DeploymentTests : CLITestBase
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче