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
|
@ -7,14 +7,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
public sealed class BuildServerCommand : DotnetCommand
|
||||
{
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
return base.Execute($"build-server {args}");
|
||||
}
|
||||
public override CommandResult Execute(string args = "") => base.Execute($"build-server {args}");
|
||||
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
return base.ExecuteWithCapturedOutput($"build-server {args}");
|
||||
}
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput($"build-server {args}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,19 +7,10 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
public sealed class HelpCommand : DotnetCommand
|
||||
{
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
return base.Execute(AppendHelp(args));
|
||||
}
|
||||
public override CommandResult Execute(string args = "") => base.Execute(AppendHelp(args));
|
||||
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
return base.ExecuteWithCapturedOutput(AppendHelp(args));
|
||||
}
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput(AppendHelp(args));
|
||||
|
||||
private string AppendHelp(string args)
|
||||
{
|
||||
return args = $"help {args}";
|
||||
}
|
||||
private string AppendHelp(string args) => args = $"help {args}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,9 +76,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return $"{_projectPath} {OutputOption} {BuildBasePathOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption} {ServiceableOption}";
|
||||
}
|
||||
private string BuildArgs() => $"{_projectPath} {OutputOption} {BuildBasePathOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption} {ServiceableOption}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return this;
|
||||
}
|
||||
|
||||
public PublishCommand WithFramework(NuGetFramework framework)
|
||||
{
|
||||
return WithFramework(framework.GetShortFolderName());
|
||||
}
|
||||
public PublishCommand WithFramework(NuGetFramework framework) => WithFramework(framework.GetShortFolderName());
|
||||
|
||||
public PublishCommand WithOutput(string output)
|
||||
{
|
||||
|
@ -62,15 +59,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return string.Join(" ",
|
||||
private string BuildArgs() => string.Join(" ",
|
||||
FrameworkOption,
|
||||
OutputOption,
|
||||
TargetOption,
|
||||
RuntimeOption,
|
||||
SelfContainedOption);
|
||||
}
|
||||
|
||||
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
|
||||
|
||||
|
|
|
@ -28,10 +28,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return this;
|
||||
}
|
||||
|
||||
public StoreCommand WithFramework(NuGetFramework framework)
|
||||
{
|
||||
return WithFramework(framework.GetShortFolderName());
|
||||
}
|
||||
public StoreCommand WithFramework(NuGetFramework framework) => WithFramework(framework.GetShortFolderName());
|
||||
|
||||
public StoreCommand WithOutput(string output)
|
||||
{
|
||||
|
@ -69,16 +66,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return string.Join(" ",
|
||||
private string BuildArgs() => string.Join(" ",
|
||||
ProfileProjectOption,
|
||||
FrameworkOption,
|
||||
OutputOption,
|
||||
IntermediateWorkingDirectoryOption,
|
||||
RuntimeOption,
|
||||
FrameworkVersionOption);
|
||||
}
|
||||
|
||||
private string ProfileProjectOption => string.Join(" ", _profileProject) ;
|
||||
|
||||
|
|
|
@ -48,10 +48,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
CurrentProcess.KillTree();
|
||||
}
|
||||
|
||||
public virtual CommandResult Execute(string args = "")
|
||||
{
|
||||
return Task.Run(async () => await ExecuteAsync(args)).Result;
|
||||
}
|
||||
public virtual CommandResult Execute(string args = "") => Task.Run(async () => await ExecuteAsync(args)).Result;
|
||||
|
||||
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
|
||||
return AppDomain.CurrentDomain.BaseDirectory;
|
||||
#else
|
||||
return AppContext.BaseDirectory;
|
||||
AppContext.BaseDirectory;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
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 override CommandResult Execute(string args = "")
|
||||
{
|
||||
return base.Execute($"tool {args}");
|
||||
}
|
||||
public override CommandResult Execute(string args = "") => base.Execute($"tool {args}");
|
||||
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
return base.ExecuteWithCapturedOutput($"tool {args}");
|
||||
}
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "") => base.ExecuteWithCapturedOutput($"tool {args}");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue