Use "obfuscated_" + Guid.NewGuid().ToString() everywhere in tests

This commit is contained in:
Ivan Kochurkin 2020-08-22 14:27:16 +03:00
Родитель e987ad1951
Коммит 5d9432a84f
3 изменённых файлов: 5 добавлений и 8 удалений

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

@ -24,7 +24,6 @@ namespace _123_InheritCustomAttr.Test {
new[] {"Monday", "43", "1"}, new[] {"Monday", "43", "1"},
new SettingItem<Protection>("rename") {{"mode", renameMode}, {"flatten", flatten ? "True" : "False"}}, new SettingItem<Protection>("rename") {{"mode", renameMode}, {"flatten", flatten ? "True" : "False"}},
outputHelper, outputHelper,
"testtmp_" + Guid.NewGuid(),
l => Assert.False(l.StartsWith("[WARN]"), "Logged line may not start with [WARN]\r\n" + l)); l => Assert.False(l.StartsWith("[WARN]"), "Logged line may not start with [WARN]\r\n" + l));
public static IEnumerable<object[]> InheritCustomAttributeData() { public static IEnumerable<object[]> InheritCustomAttributeData() {

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

@ -30,8 +30,7 @@ namespace DynamicTypeRename.Test {
{ "mode", renameMode }, { "mode", renameMode },
{ "flatten", flatten.ToString() } { "flatten", flatten.ToString() }
}, },
outputHelper, outputHelper
"testtmp_" + Guid.NewGuid()
); );
public static IEnumerable<object[]> RenameDynamicTypeData() { public static IEnumerable<object[]> RenameDynamicTypeData() {

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

@ -10,19 +10,18 @@ using Xunit.Abstractions;
namespace Confuser.UnitTest { namespace Confuser.UnitTest {
public static class TestRunner { public static class TestRunner {
public static async Task Run(string inputFileName, string[] expectedOutput, SettingItem<Protection> protection, public static async Task Run(string inputFileName, string[] expectedOutput, SettingItem<Protection> protection,
ITestOutputHelper outputHelper, ITestOutputHelper outputHelper, Action<string> outputAction = null, SettingItem<Packer> packer = null,
string tempDirectory = "testtmp", Action<string> outputAction = null, SettingItem<Packer> packer = null,
Action<ProjectModule> projectModuleAction = null) => Action<ProjectModule> projectModuleAction = null) =>
await Run(new[] {inputFileName}, expectedOutput, protection, outputHelper, tempDirectory, outputAction, packer, await Run(new[] {inputFileName}, expectedOutput, protection, outputHelper, outputAction, packer,
projectModuleAction); projectModuleAction);
public static async Task Run(string[] inputFileNames, string[] expectedOutput, SettingItem<Protection> protection, ITestOutputHelper outputHelper, public static async Task Run(string[] inputFileNames, string[] expectedOutput, SettingItem<Protection> protection, ITestOutputHelper outputHelper,
string tempDirectory = "testtmp", Action<string> outputAction = null, SettingItem<Packer> packer = null, Action<string> outputAction = null, SettingItem<Packer> packer = null,
Action<ProjectModule> projectModuleAction = null) { Action<ProjectModule> projectModuleAction = null) {
var baseDir = Environment.CurrentDirectory; var baseDir = Environment.CurrentDirectory;
var outputDir = Path.Combine(baseDir, tempDirectory); var outputDir = Path.Combine(baseDir, "obfuscated_" + Guid.NewGuid().ToString());
string entryInputFileName = Path.Combine(baseDir, inputFileNames[0]); string entryInputFileName = Path.Combine(baseDir, inputFileNames[0]);
var entryOutputFileName = Path.Combine(outputDir, inputFileNames[0]); var entryOutputFileName = Path.Combine(outputDir, inputFileNames[0]);
FileUtilities.ClearOutput(entryOutputFileName); FileUtilities.ClearOutput(entryOutputFileName);