Applied expression bodies for methods to solution.
This commit is contained in:
parent
c9ab438e6c
commit
67cbc0dd65
36 changed files with 106 additions and 378 deletions
|
@ -205,15 +205,9 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteBlob(string path)
|
private void DeleteBlob(string path) => _blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait();
|
||||||
{
|
|
||||||
_blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string CalculateRelativePathForFile(string file, Product product, string version)
|
private static string CalculateRelativePathForFile(string file, Product product, string version) => $"{product}/{version}/{Path.GetFileName(file)}";
|
||||||
{
|
|
||||||
return $"{product}/{version}/{Path.GetFileName(file)}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,25 +20,13 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
||||||
|
|
||||||
protected override string GenerateFullPathToTool()
|
protected override string GenerateFullPathToTool() => "chmod";
|
||||||
{
|
|
||||||
return "chmod";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands()
|
protected override string GenerateCommandLineCommands() => $"{GetRecursive()} {GetMode()} {GetGlob()}";
|
||||||
{
|
|
||||||
return $"{GetRecursive()} {GetMode()} {GetGlob()}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetGlob()
|
private string GetGlob() => Glob;
|
||||||
{
|
|
||||||
return Glob;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetMode()
|
private string GetMode() => Mode;
|
||||||
{
|
|
||||||
return Mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetRecursive()
|
private string GetRecursive()
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,15 +127,9 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
return "crossgen2";
|
return "crossgen2";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands()
|
protected override string GenerateCommandLineCommands() => $"{GetInPath()} {GetOutPath()} {GetArchitecture()} {GetPlatformAssemblyPaths()} {GetCreateSymbols()}";
|
||||||
{
|
|
||||||
return $"{GetInPath()} {GetOutPath()} {GetArchitecture()} {GetPlatformAssemblyPaths()} {GetCreateSymbols()}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetArchitecture()
|
private string GetArchitecture() => $"--targetarch {Architecture}";
|
||||||
{
|
|
||||||
return $"--targetarch {Architecture}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetCreateSymbols()
|
private string GetCreateSymbols()
|
||||||
{
|
{
|
||||||
|
@ -153,15 +147,9 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetInPath()
|
private string GetInPath() => $"\"{SourceAssembly}\"";
|
||||||
{
|
|
||||||
return $"\"{SourceAssembly}\"";
|
private string GetOutPath() => $"-o \"{TempOutputPath}\"";
|
||||||
}
|
|
||||||
|
|
||||||
private string GetOutPath()
|
|
||||||
{
|
|
||||||
return $"-o \"{TempOutputPath}\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetPlatformAssemblyPaths()
|
private string GetPlatformAssemblyPaths()
|
||||||
{
|
{
|
||||||
|
@ -177,15 +165,9 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
|
|
||||||
return platformAssemblyPaths;
|
return platformAssemblyPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetMissingDependenciesOk()
|
|
||||||
{
|
|
||||||
return "-MissingDependenciesOK";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LogToolCommand(string message)
|
private string GetMissingDependenciesOk() => "-MissingDependenciesOK";
|
||||||
{
|
|
||||||
base.LogToolCommand($"{base.GetWorkingDirectory()}> {message}");
|
protected override void LogToolCommand(string message) => base.LogToolCommand($"{base.GetWorkingDirectory()}> {message}");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,25 +25,13 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
protected override string ToolName => "package_tool.sh";
|
protected override string ToolName => "package_tool.sh";
|
||||||
|
|
||||||
private string GetInputDir()
|
private string GetInputDir() => $"-i {InputDirectory}";
|
||||||
{
|
|
||||||
return $"-i {InputDirectory}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetOutputFile()
|
private string GetOutputFile() => $"-o {OutputDirectory}";
|
||||||
{
|
|
||||||
return $"-o {OutputDirectory}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetPackageName()
|
private string GetPackageName() => $"-n {PackageName}";
|
||||||
{
|
|
||||||
return $"-n {PackageName}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetPackageVersion()
|
private string GetPackageVersion() => $"-v {PackageVersion}";
|
||||||
{
|
|
||||||
return $"-v {PackageVersion}";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
||||||
|
|
||||||
|
@ -62,10 +50,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetWorkingDirectory()
|
protected override string GetWorkingDirectory() => WorkingDirectory ?? base.GetWorkingDirectory();
|
||||||
{
|
|
||||||
return WorkingDirectory ?? base.GetWorkingDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands()
|
protected override string GenerateCommandLineCommands()
|
||||||
{
|
{
|
||||||
|
@ -76,15 +61,9 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return commandLineCommands;
|
return commandLineCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogToolCommand(string message)
|
protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}");
|
||||||
{
|
|
||||||
base.LogToolCommand($"{GetWorkingDirectory()}> {message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance)
|
protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) => Log.LogMessage(messageImportance, singleLine, null);
|
||||||
{
|
|
||||||
Log.LogMessage(messageImportance, singleLine, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ProcessStartInfo GetProcessStartInfo(
|
protected override ProcessStartInfo GetProcessStartInfo(
|
||||||
string pathToTool,
|
string pathToTool,
|
||||||
|
|
|
@ -58,10 +58,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetWorkingDirectory()
|
protected override string GetWorkingDirectory() => WorkingDirectory ?? base.GetWorkingDirectory();
|
||||||
{
|
|
||||||
return WorkingDirectory ?? base.GetWorkingDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands()
|
protected override string GenerateCommandLineCommands()
|
||||||
{
|
{
|
||||||
|
@ -72,9 +69,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return commandLineCommands;
|
return commandLineCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogToolCommand(string message)
|
protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}");
|
||||||
{
|
|
||||||
base.LogToolCommand($"{GetWorkingDirectory()}> {message}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,14 +193,8 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
|
|
||||||
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
||||||
|
|
||||||
protected override string GenerateFullPathToTool()
|
protected override string GenerateFullPathToTool() => "tar";
|
||||||
{
|
|
||||||
return "tar";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands()
|
protected override string GenerateCommandLineCommands() => $"xf {SourceArchive} -C {DestinationDirectory}";
|
||||||
{
|
|
||||||
return $"xf {SourceArchive} -C {DestinationDirectory}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,24 +88,15 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Execute()
|
public override bool Execute() => base.Execute();
|
||||||
{
|
|
||||||
return base.Execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string ToolName => "tar";
|
protected override string ToolName => "tar";
|
||||||
|
|
||||||
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
||||||
|
|
||||||
protected override string GenerateFullPathToTool()
|
protected override string GenerateFullPathToTool() => "tar";
|
||||||
{
|
|
||||||
return "tar";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands()
|
protected override string GenerateCommandLineCommands() => $"{GetDestinationArchive()} {GetSourceSpecification()}";
|
||||||
{
|
|
||||||
return $"{GetDestinationArchive()} {GetSourceSpecification()}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetSourceSpecification()
|
private string GetSourceSpecification()
|
||||||
{
|
{
|
||||||
|
@ -123,10 +114,7 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetDestinationArchive()
|
private string GetDestinationArchive() => $"-czf {DestinationArchive}";
|
||||||
{
|
|
||||||
return $"-czf {DestinationArchive}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetExcludes()
|
private string GetExcludes()
|
||||||
{
|
{
|
||||||
|
@ -142,10 +130,7 @@ namespace Microsoft.DotNet.Build.Tasks
|
||||||
|
|
||||||
return excludes;
|
return excludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogToolCommand(string message)
|
protected override void LogToolCommand(string message) => base.LogToolCommand($"{base.GetWorkingDirectory()}> {message}");
|
||||||
{
|
|
||||||
base.LogToolCommand($"{base.GetWorkingDirectory()}> {message}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile)
|
private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) =>
|
||||||
{
|
|
||||||
// Example output:
|
// Example output:
|
||||||
|
|
||||||
// $ dpkg --info dotnet-sdk-2.1.105-ubuntu-x64.deb
|
// $ dpkg --info dotnet-sdk-2.1.105-ubuntu-x64.deb
|
||||||
|
@ -58,10 +57,8 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
||||||
.Should().Pass()
|
.Should().Pass()
|
||||||
.And.HaveStdOutMatching(@"Depends:.*\s?dotnet-runtime-\d+(\.\d+){2}")
|
.And.HaveStdOutMatching(@"Depends:.*\s?dotnet-runtime-\d+(\.\d+){2}")
|
||||||
.And.HaveStdOutMatching(@"Depends:.*\s?aspnetcore-store-\d+(\.\d+){2}");
|
.And.HaveStdOutMatching(@"Depends:.*\s?aspnetcore-store-\d+(\.\d+){2}");
|
||||||
}
|
|
||||||
|
|
||||||
private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile)
|
private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) =>
|
||||||
{
|
|
||||||
// Example output:
|
// Example output:
|
||||||
|
|
||||||
// $ rpm -qpR dotnet-sdk-2.1.105-rhel-x64.rpm
|
// $ rpm -qpR dotnet-sdk-2.1.105-rhel-x64.rpm
|
||||||
|
@ -78,6 +75,5 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
||||||
.Should().Pass()
|
.Should().Pass()
|
||||||
.And.HaveStdOutMatching(@"dotnet-runtime-\d+(\.\d+){2} >= \d+(\.\d+){2}")
|
.And.HaveStdOutMatching(@"dotnet-runtime-\d+(\.\d+){2} >= \d+(\.\d+){2}")
|
||||||
.And.HaveStdOutMatching(@"aspnetcore-store-\d+(\.\d+){2} >= \d+(\.\d+){2}");
|
.And.HaveStdOutMatching(@"aspnetcore-store-\d+(\.\d+){2} >= \d+(\.\d+){2}");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,8 @@ namespace EndToEnd
|
||||||
public class GivenDotnetUsesDotnetTools : TestBase
|
public class GivenDotnetUsesDotnetTools : TestBase
|
||||||
{
|
{
|
||||||
[RequiresAspNetCore]
|
[RequiresAspNetCore]
|
||||||
public void ThenOneDotnetToolsCanBeCalled()
|
public void ThenOneDotnetToolsCanBeCalled() => new DotnetCommand()
|
||||||
{
|
|
||||||
new DotnetCommand()
|
|
||||||
.ExecuteWithCapturedOutput("dev-certs --help")
|
.ExecuteWithCapturedOutput("dev-certs --help")
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,7 @@ namespace EndToEnd
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[ClassData(typeof(SupportedAspNetCoreAllVersions))]
|
[ClassData(typeof(SupportedAspNetCoreAllVersions))]
|
||||||
public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreAll(string minorVersion)
|
public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreAll(string minorVersion) => ItDoesNotRollForwardToTheLatestVersion(TestProjectCreator.AspNetCoreAllPackageName, minorVersion);
|
||||||
{
|
|
||||||
ItDoesNotRollForwardToTheLatestVersion(TestProjectCreator.AspNetCoreAllPackageName, minorVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void ItDoesNotRollForwardToTheLatestVersion(string packageName, string minorVersion)
|
internal void ItDoesNotRollForwardToTheLatestVersion(string packageName, string minorVersion)
|
||||||
{
|
{
|
||||||
|
@ -87,13 +84,10 @@ namespace EndToEnd
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName)
|
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) => lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier == null)
|
||||||
{
|
|
||||||
return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier == null)
|
|
||||||
?.Libraries?.SingleOrDefault(l =>
|
?.Libraries?.SingleOrDefault(l =>
|
||||||
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
|
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||||
?.Version;
|
?.Version;
|
||||||
}
|
|
||||||
|
|
||||||
public string GetExpectedVersion(string packageName, string minorVersion)
|
public string GetExpectedVersion(string packageName, string minorVersion)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,13 +92,10 @@ namespace EndToEnd
|
||||||
"needs to be updated (see the ImplicitPackageVariable items in MSBuildExtensions.targets in this repo)");
|
"needs to be updated (see the ImplicitPackageVariable items in MSBuildExtensions.targets in this repo)");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName)
|
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) => lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null)
|
||||||
{
|
|
||||||
return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null)
|
|
||||||
?.Libraries?.SingleOrDefault(l =>
|
?.Libraries?.SingleOrDefault(l =>
|
||||||
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
|
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||||
?.Version;
|
?.Version;
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void WeCoverLatestNetCoreAppRollForward()
|
public void WeCoverLatestNetCoreAppRollForward()
|
||||||
|
|
|
@ -191,10 +191,7 @@ namespace EndToEnd.Tests
|
||||||
[InlineData("nunit")]
|
[InlineData("nunit")]
|
||||||
[InlineData("web")]
|
[InlineData("web")]
|
||||||
[InlineData("mvc")]
|
[InlineData("mvc")]
|
||||||
public void ItCanBuildTemplates(string templateName, string language = "")
|
public void ItCanBuildTemplates(string templateName, string language = "") => TestTemplateCreateAndBuild(templateName, language: language);
|
||||||
{
|
|
||||||
TestTemplateCreateAndBuild(templateName, language: language);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The test checks if dotnet new shows curated list correctly after the SDK installation and template insertion.
|
/// The test checks if dotnet new shows curated list correctly after the SDK installation and template insertion.
|
||||||
|
@ -309,25 +306,16 @@ namespace EndToEnd.Tests
|
||||||
[WindowsOnlyTheory]
|
[WindowsOnlyTheory]
|
||||||
[InlineData("wpf")]
|
[InlineData("wpf")]
|
||||||
[InlineData("winforms")]
|
[InlineData("winforms")]
|
||||||
public void ItCanBuildDesktopTemplates(string templateName)
|
public void ItCanBuildDesktopTemplates(string templateName) => TestTemplateCreateAndBuild(templateName);
|
||||||
{
|
|
||||||
TestTemplateCreateAndBuild(templateName);
|
|
||||||
}
|
|
||||||
|
|
||||||
[WindowsOnlyTheory]
|
[WindowsOnlyTheory]
|
||||||
[InlineData("wpf")]
|
[InlineData("wpf")]
|
||||||
public void ItCanBuildDesktopTemplatesSelfContained(string templateName)
|
public void ItCanBuildDesktopTemplatesSelfContained(string templateName) => TestTemplateCreateAndBuild(templateName, selfContained: true);
|
||||||
{
|
|
||||||
TestTemplateCreateAndBuild(templateName, selfContained: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("web")]
|
[InlineData("web")]
|
||||||
[InlineData("console")]
|
[InlineData("console")]
|
||||||
public void ItCanBuildTemplatesSelfContained(string templateName)
|
public void ItCanBuildTemplatesSelfContained(string templateName) => TestTemplateCreateAndBuild(templateName, selfContained: true);
|
||||||
{
|
|
||||||
TestTemplateCreateAndBuild(templateName, selfContained: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The test checks if the template creates the template for correct framework by default.
|
/// The test checks if the template creates the template for correct framework by default.
|
||||||
|
|
|
@ -7,9 +7,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public static class CommandResultExtensions
|
public static class CommandResultExtensions
|
||||||
{
|
{
|
||||||
public static CommandResultAssertions Should(this CommandResult commandResult)
|
public static CommandResultAssertions Should(this CommandResult commandResult) => new CommandResultAssertions(commandResult);
|
||||||
{
|
|
||||||
return new CommandResultAssertions(commandResult);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,29 +11,14 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public static class DirectoryInfoExtensions
|
public static class DirectoryInfoExtensions
|
||||||
{
|
{
|
||||||
public static DirectoryInfoAssertions Should(this DirectoryInfo dir)
|
public static DirectoryInfoAssertions Should(this DirectoryInfo dir) => new DirectoryInfoAssertions(dir);
|
||||||
{
|
|
||||||
return new DirectoryInfoAssertions(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DirectoryInfo Sub(this DirectoryInfo dir, string name)
|
public static DirectoryInfo Sub(this DirectoryInfo dir, string name) => new DirectoryInfo(Path.Combine(dir.FullName, name));
|
||||||
{
|
|
||||||
return new DirectoryInfo(Path.Combine(dir.FullName, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Contains(this DirectoryInfo subject, FileSystemInfo target)
|
public static bool Contains(this DirectoryInfo subject, FileSystemInfo target) => target.FullName.StartsWith(subject.FullName);
|
||||||
{
|
|
||||||
return target.FullName.StartsWith(subject.FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string [] directoryNames)
|
public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string[] directoryNames) => new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames)));
|
||||||
{
|
|
||||||
return new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FileInfo GetFile(this DirectoryInfo subject, string fileName)
|
public static FileInfo GetFile(this DirectoryInfo subject, string fileName) => new FileInfo(Path.Combine(subject.FullName, fileName));
|
||||||
{
|
|
||||||
return new FileInfo(Path.Combine(subject.FullName, fileName));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
_fileStream = fileInfo.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
|
_fileStream = fileInfo.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose() => _fileStream.Dispose();
|
||||||
{
|
|
||||||
_fileStream.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,24 +11,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public static partial class FileInfoExtensions
|
public static partial class FileInfoExtensions
|
||||||
{
|
{
|
||||||
public static FileInfoAssertions Should(this FileInfo file)
|
public static FileInfoAssertions Should(this FileInfo file) => new FileInfoAssertions(file);
|
||||||
{
|
|
||||||
return new FileInfoAssertions(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDisposable Lock(this FileInfo subject)
|
public static IDisposable Lock(this FileInfo subject) => new FileInfoLock(subject);
|
||||||
{
|
|
||||||
return new FileInfoLock(subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDisposable NuGetLock(this FileInfo subject)
|
public static IDisposable NuGetLock(this FileInfo subject) => new FileInfoNuGetLock(subject);
|
||||||
{
|
|
||||||
return new FileInfoNuGetLock(subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ReadAllText(this FileInfo subject)
|
public static string ReadAllText(this FileInfo subject) => File.ReadAllText(subject.FullName);
|
||||||
{
|
|
||||||
return File.ReadAllText(subject.FullName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public static class StringAssertionsExtensions
|
public static class StringAssertionsExtensions
|
||||||
{
|
{
|
||||||
private static string NormalizeLineEndings(string s)
|
private static string NormalizeLineEndings(string s) => s.Replace("\r\n", "\n");
|
||||||
{
|
|
||||||
return s.Replace("\r\n", "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AndConstraint<StringAssertions> BeVisuallyEquivalentTo(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs)
|
public static AndConstraint<StringAssertions> BeVisuallyEquivalentTo(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,19 +12,10 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
|
||||||
public void WriteLine(string format, params object?[] args) => WriteLine(string.Format(format, args));
|
public void WriteLine(string format, params object?[] args) => WriteLine(string.Format(format, args));
|
||||||
|
|
||||||
public void WriteLine(string message)
|
public void WriteLine(string message) => Lines.Add(message);
|
||||||
{
|
|
||||||
Lines.Add(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteLine()
|
public void WriteLine() => Lines.Add("");
|
||||||
{
|
|
||||||
Lines.Add("");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Write(string message)
|
public void Write(string message) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,14 +7,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public sealed class BuildServerCommand : DotnetCommand
|
public sealed class BuildServerCommand : DotnetCommand
|
||||||
{
|
{
|
||||||
public override CommandResult Execute(string args = "")
|
public override CommandResult Execute(string args = "") => base.Execute($"build-server {args}");
|
||||||
{
|
|
||||||
return base.Execute($"build-server {args}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput($"build-server {args}");
|
||||||
{
|
|
||||||
return base.ExecuteWithCapturedOutput($"build-server {args}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,10 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public sealed class HelpCommand : DotnetCommand
|
public sealed class HelpCommand : DotnetCommand
|
||||||
{
|
{
|
||||||
public override CommandResult Execute(string args = "")
|
public override CommandResult Execute(string args = "") => base.Execute(AppendHelp(args));
|
||||||
{
|
|
||||||
return base.Execute(AppendHelp(args));
|
|
||||||
}
|
|
||||||
|
|
||||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput(AppendHelp(args));
|
||||||
{
|
|
||||||
return base.ExecuteWithCapturedOutput(AppendHelp(args));
|
|
||||||
}
|
|
||||||
|
|
||||||
private string AppendHelp(string args)
|
private string AppendHelp(string args) => args = $"help {args}";
|
||||||
{
|
|
||||||
return args = $"help {args}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return base.ExecuteWithCapturedOutput(args);
|
return base.ExecuteWithCapturedOutput(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildArgs()
|
private string BuildArgs() => $"{_projectPath} {OutputOption} {BuildBasePathOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption} {ServiceableOption}";
|
||||||
{
|
|
||||||
return $"{_projectPath} {OutputOption} {BuildBasePathOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption} {ServiceableOption}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PublishCommand WithFramework(NuGetFramework framework)
|
public PublishCommand WithFramework(NuGetFramework framework) => WithFramework(framework.GetShortFolderName());
|
||||||
{
|
|
||||||
return WithFramework(framework.GetShortFolderName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublishCommand WithOutput(string output)
|
public PublishCommand WithOutput(string output)
|
||||||
{
|
{
|
||||||
|
@ -62,15 +59,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return base.ExecuteWithCapturedOutput(args);
|
return base.ExecuteWithCapturedOutput(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildArgs()
|
private string BuildArgs() => string.Join(" ",
|
||||||
{
|
|
||||||
return string.Join(" ",
|
|
||||||
FrameworkOption,
|
FrameworkOption,
|
||||||
OutputOption,
|
OutputOption,
|
||||||
TargetOption,
|
TargetOption,
|
||||||
RuntimeOption,
|
RuntimeOption,
|
||||||
SelfContainedOption);
|
SelfContainedOption);
|
||||||
}
|
|
||||||
|
|
||||||
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
|
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoreCommand WithFramework(NuGetFramework framework)
|
public StoreCommand WithFramework(NuGetFramework framework) => WithFramework(framework.GetShortFolderName());
|
||||||
{
|
|
||||||
return WithFramework(framework.GetShortFolderName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public StoreCommand WithOutput(string output)
|
public StoreCommand WithOutput(string output)
|
||||||
{
|
{
|
||||||
|
@ -69,16 +66,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return base.ExecuteWithCapturedOutput(args);
|
return base.ExecuteWithCapturedOutput(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildArgs()
|
private string BuildArgs() => string.Join(" ",
|
||||||
{
|
|
||||||
return string.Join(" ",
|
|
||||||
ProfileProjectOption,
|
ProfileProjectOption,
|
||||||
FrameworkOption,
|
FrameworkOption,
|
||||||
OutputOption,
|
OutputOption,
|
||||||
IntermediateWorkingDirectoryOption,
|
IntermediateWorkingDirectoryOption,
|
||||||
RuntimeOption,
|
RuntimeOption,
|
||||||
FrameworkVersionOption);
|
FrameworkVersionOption);
|
||||||
}
|
|
||||||
|
|
||||||
private string ProfileProjectOption => string.Join(" ", _profileProject) ;
|
private string ProfileProjectOption => string.Join(" ", _profileProject) ;
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
CurrentProcess.KillTree();
|
CurrentProcess.KillTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual CommandResult Execute(string args = "")
|
public virtual CommandResult Execute(string args = "") => Task.Run(async () => await ExecuteAsync(args)).Result;
|
||||||
{
|
|
||||||
return Task.Run(async () => await ExecuteAsync(args)).Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async virtual Task<CommandResult> ExecuteAsync(string args = "")
|
public async virtual Task<CommandResult> ExecuteAsync(string args = "")
|
||||||
{
|
{
|
||||||
|
@ -194,14 +191,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetBaseDirectory()
|
private string GetBaseDirectory() =>
|
||||||
{
|
|
||||||
#if NET451
|
#if NET451
|
||||||
return AppDomain.CurrentDomain.BaseDirectory;
|
return AppDomain.CurrentDomain.BaseDirectory;
|
||||||
#else
|
#else
|
||||||
return AppContext.BaseDirectory;
|
AppContext.BaseDirectory;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
private void ResolveCommand(ref string executable, ref string args)
|
private void ResolveCommand(ref string executable, ref string args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,14 +7,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
public sealed class ToolCommand : DotnetCommand
|
public sealed class ToolCommand : DotnetCommand
|
||||||
{
|
{
|
||||||
public override CommandResult Execute(string args = "")
|
public override CommandResult Execute(string args = "") => base.Execute($"tool {args}");
|
||||||
{
|
|
||||||
return base.Execute($"tool {args}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput($"tool {args}");
|
||||||
{
|
|
||||||
return base.ExecuteWithCapturedOutput($"tool {args}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,20 +7,11 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
{
|
{
|
||||||
internal static class DirectoryInfoExtensions
|
internal static class DirectoryInfoExtensions
|
||||||
{
|
{
|
||||||
public static bool Contains(this DirectoryInfo subject, FileSystemInfo target)
|
public static bool Contains(this DirectoryInfo subject, FileSystemInfo target) => target.FullName.StartsWith(subject.FullName);
|
||||||
{
|
|
||||||
return target.FullName.StartsWith(subject.FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string [] directoryNames)
|
public static DirectoryInfo GetDirectory(this DirectoryInfo subject, params string[] directoryNames) => new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames)));
|
||||||
{
|
|
||||||
return new DirectoryInfo(Path.Combine(subject.FullName, Path.Combine(directoryNames)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FileInfo GetFile(this DirectoryInfo subject, string fileName)
|
public static FileInfo GetFile(this DirectoryInfo subject, string fileName) => new FileInfo(Path.Combine(subject.FullName, fileName));
|
||||||
{
|
|
||||||
return new FileInfo(Path.Combine(subject.FullName, fileName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void EnsureExistsAndEmpty(this DirectoryInfo subject)
|
public static void EnsureExistsAndEmpty(this DirectoryInfo subject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,10 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
#endif
|
#endif
|
||||||
private static readonly TimeSpan _defaultTimeout = TimeSpan.FromSeconds(30);
|
private static readonly TimeSpan _defaultTimeout = TimeSpan.FromSeconds(30);
|
||||||
|
|
||||||
public static void KillTree(this Process process)
|
public static void KillTree(this Process process) => process.KillTree(_defaultTimeout);
|
||||||
{
|
|
||||||
process.KillTree(_defaultTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void KillTree(this Process process, TimeSpan timeout)
|
public static void KillTree(this Process process, TimeSpan timeout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// True if <paramref name="path"/> is a simple file name, false if it is null or includes a directory specification.
|
/// True if <paramref name="path"/> is a simple file name, false if it is null or includes a directory specification.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
internal static bool IsFileName(string path)
|
internal static bool IsFileName(string path) => IndexOfFileName(path) == 0;
|
||||||
{
|
|
||||||
return IndexOfFileName(path) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the offset in <paramref name="path"/> where the dot that starts an extension is, or -1 if the path doesn't have an extension.
|
/// Returns the offset in <paramref name="path"/> where the dot that starts an extension is, or -1 if the path doesn't have an extension.
|
||||||
|
|
|
@ -21,10 +21,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
|
||||||
private static bool IsUnixLikePlatform => Path.DirectorySeparatorChar == '/';
|
private static bool IsUnixLikePlatform => Path.DirectorySeparatorChar == '/';
|
||||||
|
|
||||||
internal static bool IsDirectorySeparator(char c)
|
internal static bool IsDirectorySeparator(char c) => c == DirectorySeparatorChar || c == AltDirectorySeparatorChar;
|
||||||
{
|
|
||||||
return c == DirectorySeparatorChar || c == AltDirectorySeparatorChar;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string TrimTrailingSeparators(string s)
|
internal static string TrimTrailingSeparators(string s)
|
||||||
{
|
{
|
||||||
|
@ -42,25 +39,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetExtension(string path)
|
internal static string GetExtension(string path) => FileNameUtilities.GetExtension(path);
|
||||||
{
|
|
||||||
return FileNameUtilities.GetExtension(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string ChangeExtension(string path, string extension)
|
internal static string ChangeExtension(string path, string extension) => FileNameUtilities.ChangeExtension(path, extension);
|
||||||
{
|
|
||||||
return FileNameUtilities.ChangeExtension(path, extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string RemoveExtension(string path)
|
internal static string RemoveExtension(string path) => FileNameUtilities.ChangeExtension(path, extension: null);
|
||||||
{
|
|
||||||
return FileNameUtilities.ChangeExtension(path, extension: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetFileName(string path)
|
internal static string GetFileName(string path) => FileNameUtilities.GetFileName(path);
|
||||||
{
|
|
||||||
return FileNameUtilities.GetFileName(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get directory name from path.
|
/// Get directory name from path.
|
||||||
|
|
|
@ -105,14 +105,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return new TempDirectory(dirPath, _root);
|
return new TempDirectory(dirPath, _root);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCurrentDirectory()
|
public void SetCurrentDirectory() => Directory.SetCurrentDirectory(_path);
|
||||||
{
|
|
||||||
Directory.SetCurrentDirectory(_path);
|
public override string ToString() => _path;
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return _path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileStream Open(FileAccess access = FileAccess.ReadWrite)
|
public FileStream Open(FileAccess access = FileAccess.ReadWrite) => new FileStream(_path, FileMode.Open, access);
|
||||||
{
|
|
||||||
return new FileStream(_path, FileMode.Open, access);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Path => _path;
|
public string Path => _path;
|
||||||
|
|
||||||
|
@ -79,12 +76,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TempFile> WriteAllTextAsync(string content)
|
public Task<TempFile> WriteAllTextAsync(string content) => WriteAllTextAsync(content, Encoding.UTF8);
|
||||||
{
|
|
||||||
return WriteAllTextAsync(content, Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TempFile WriteAllBytes(byte[] content)
|
public TempFile WriteAllBytes(byte[] content)
|
||||||
{
|
{
|
||||||
File.WriteAllBytes(_path, content);
|
File.WriteAllBytes(_path, content);
|
||||||
|
@ -96,20 +90,11 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
content.WriteToFile(_path);
|
content.WriteToFile(_path);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadAllText()
|
public string ReadAllText() => File.ReadAllText(_path);
|
||||||
{
|
|
||||||
return File.ReadAllText(_path);
|
public TempFile CopyContentFrom(string path) => WriteAllBytes(File.ReadAllBytes(path));
|
||||||
}
|
|
||||||
|
public override string ToString() => _path;
|
||||||
public TempFile CopyContentFrom(string path)
|
|
||||||
{
|
|
||||||
return WriteAllBytes(File.ReadAllBytes(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return _path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,12 +61,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
_temps.Add(dir);
|
_temps.Add(dir);
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TempFile CreateFile(string prefix = null, string extension = null, string directory = null, [CallerFilePath]string callerSourcePath = null, [CallerLineNumber]int callerLineNumber = 0)
|
public TempFile CreateFile(string prefix = null, string extension = null, string directory = null, [CallerFilePath] string callerSourcePath = null, [CallerLineNumber] int callerLineNumber = 0) => AddFile(new DisposableFile(prefix, extension, directory, callerSourcePath, callerLineNumber));
|
||||||
{
|
|
||||||
return AddFile(new DisposableFile(prefix, extension, directory, callerSourcePath, callerLineNumber));
|
|
||||||
}
|
|
||||||
|
|
||||||
public DisposableFile AddFile(DisposableFile file)
|
public DisposableFile AddFile(DisposableFile file)
|
||||||
{
|
{
|
||||||
_temps.Add(file);
|
_temps.Add(file);
|
||||||
|
|
|
@ -68,10 +68,7 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
.Where(f => !FilesToExclude.Contains(f.Name));
|
.Where(f => !FilesToExclude.Contains(f.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private DirectoryInfo GetTestDestinationDirectory(string callingMethod, string identifier)
|
private DirectoryInfo GetTestDestinationDirectory(string callingMethod, string identifier) => _testAssets.CreateTestDirectory(AssetName, callingMethod, identifier);
|
||||||
{
|
|
||||||
return _testAssets.CreateTestDirectory(AssetName, callingMethod, identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ThrowIfTestAssetDoesNotExist()
|
private void ThrowIfTestAssetDoesNotExist()
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,10 +129,7 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestAssetInstance WithProjectChanges(Action<XDocument> xmlAction)
|
public TestAssetInstance WithProjectChanges(Action<XDocument> xmlAction) => WithProjectChanges((path, project) => xmlAction(project));
|
||||||
{
|
|
||||||
return WithProjectChanges((path, project) => xmlAction(project));
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestAssetInstance WithProjectChanges(Action<string, XDocument> xmlAction)
|
public TestAssetInstance WithProjectChanges(Action<string, XDocument> xmlAction)
|
||||||
{
|
{
|
||||||
|
@ -211,10 +208,7 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<FileInfo> GetProjectFiles()
|
private IEnumerable<FileInfo> GetProjectFiles() => Root.GetFiles(TestAssetInfo.ProjectFilePattern, SearchOption.AllDirectories);
|
||||||
{
|
|
||||||
return Root.GetFiles(TestAssetInfo.ProjectFilePattern, SearchOption.AllDirectories);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Restore(FileInfo projectFile)
|
private void Restore(FileInfo projectFile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,10 +49,7 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
_testWorkingFolder = testWorkingFolder;
|
_testWorkingFolder = testWorkingFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestAssetInfo Get(string name)
|
public TestAssetInfo Get(string name) => Get(TestAssetKinds.TestProjects, name);
|
||||||
{
|
|
||||||
return Get(TestAssetKinds.TestProjects, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestAssetInfo Get(string kind, string name)
|
public TestAssetInfo Get(string kind, string name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,10 +58,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetUniqueName()
|
public static string GetUniqueName() => Guid.NewGuid().ToString("D");
|
||||||
{
|
|
||||||
return Guid.NewGuid().ToString("D");
|
|
||||||
}
|
|
||||||
|
|
||||||
public TempRoot Temp
|
public TempRoot Temp
|
||||||
{
|
{
|
||||||
|
@ -126,15 +123,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
string outputDir,
|
string outputDir,
|
||||||
string executableName,
|
string executableName,
|
||||||
string expectedOutput,
|
string expectedOutput,
|
||||||
bool native = false)
|
bool native = false) => TestExecutable(GetCompilationOutputPath(outputDir, native), executableName, expectedOutput);
|
||||||
{
|
|
||||||
TestExecutable(GetCompilationOutputPath(outputDir, native), executableName, expectedOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput)
|
protected void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput) => TestOutputExecutable(outputDir, executableName, expectedOutput, true);
|
||||||
{
|
|
||||||
TestOutputExecutable(outputDir, executableName, expectedOutput, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected string GetCompilationOutputPath(string outputDir, bool native)
|
protected string GetCompilationOutputPath(string outputDir, bool native)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue