DeploymentItem: add test for file deployment using Windows/Linux path… (#1709)

This commit is contained in:
Amaury Levé 2023-07-10 14:04:37 +02:00 коммит произвёл GitHub
Родитель 14b62451fb
Коммит 0ee05864fe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -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();
}
}