2016-04-26 16:10:28 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2016-04-23 00:06:55 +00:00
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
|
|
|
using Microsoft.DotNet.TestFramework;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Builder.Tests
|
|
|
|
|
{
|
|
|
|
|
public class PerformanceTestBase : TestBase
|
|
|
|
|
{
|
|
|
|
|
protected void Build(string project)
|
|
|
|
|
{
|
|
|
|
|
Run(new BuildCommand(project, buildProfile: false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Run(TestCommand command)
|
|
|
|
|
{
|
|
|
|
|
command.Execute().Should().Pass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void RemoveBin(string project)
|
|
|
|
|
{
|
|
|
|
|
Directory.Delete(Path.Combine(project, "bin"), true);
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-26 16:10:28 +00:00
|
|
|
|
protected TestInstance[] CreateTestInstances(string[] testProjectNames, [CallerMemberName] string callingMethod = "")
|
2016-04-23 00:06:55 +00:00
|
|
|
|
{
|
2016-04-26 16:10:28 +00:00
|
|
|
|
return testProjectNames.Select(testProjectName =>
|
2016-04-23 00:06:55 +00:00
|
|
|
|
{
|
2016-04-26 16:10:28 +00:00
|
|
|
|
return CreateTestInstance(testProjectName, callingMethod);
|
|
|
|
|
}).ToArray();
|
2016-04-23 00:06:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-26 16:10:28 +00:00
|
|
|
|
protected TestInstance CreateTestInstance(string testProjectName, [CallerMemberName] string callingMethod = "")
|
2016-04-23 00:06:55 +00:00
|
|
|
|
{
|
2016-04-26 16:10:28 +00:00
|
|
|
|
return TestAssetsManager.CreateTestInstance(Path.Combine("PerformanceTestProjects", testProjectName), callingMethod)
|
|
|
|
|
.WithLockFiles();
|
2016-04-23 00:06:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|