ArgumentAliases

Namespace: Cake.Common
We found 9 examples in language CSharp for this search. You will see 24 fragments of code.

Other methods

#load "./../utilities/xunit.cake"

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Common.ArgumentAliases.HasArgument")
    .Does(() =>
{
    // Given, When
    var arg = HasArgument("customarg");
    
    // Then
    Assert.True(arg);
});

Task("Cake.Common.ArgumentAliases.HasArgument.ThatDoNotExist")
    .Does(() =>
{
    // Given, When
    var arg = HasArgument("nonexisting");
    
    // Then
    Assert.False(arg);
});

Task("Cake.Common.ArgumentAliases.Argument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<string>("customarg");

    // Then
    Assert.Equal("hello", arg);
});

Task("Cake.Common.ArgumentAliases.Argument.WithDefaultValue")
    .Does(() =>
{
    // Given, When
    var arg = Argument<string>("nonexisting", "foo");

    // Then
    Assert.Equal("foo", arg);
});

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Common.ArgumentAliases")
  .IsDependentOn("Cake.Common.ArgumentAliases.HasArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.HasArgument.ThatDoNotExist")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.WithDefaultValue");

#load "./../utilities/xunit.cake"

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Common.ArgumentAliases.HasArgument")
    .Does(() =>
{
    // Given, When
    var arg = HasArgument("customarg");
    
    // Then
    Assert.True(arg);
});

Task("Cake.Common.ArgumentAliases.HasArgument.ThatDoNotExist")
    .Does(() =>
{
    // Given, When
    var arg = HasArgument("nonexisting");
    
    // Then
    Assert.False(arg);
});

Task("Cake.Common.ArgumentAliases.Argument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<string>("customarg");

    // Then
    Assert.Equal("hello", arg);
});

Task("Cake.Common.ArgumentAliases.Argument.WithDefaultValue")
    .Does(() =>
{
    // Given, When
    var arg = Argument<string>("nonexisting", "foo");

    // Then
    Assert.Equal("foo", arg);
});

Task("Cake.Common.ArgumentAliases.Argument.MultipleArguments")
    .Does(() =>
{
    
    // Given, When
    var arg = Arguments<string>("multipleargs");

    // Then
    Assert.Equal(new[] {"a", "b"}, arg);
});

Task("Cake.Common.ArgumentAliases.Argument.DirectoryPathArgument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<DirectoryPath>("testAssemblyDirectoryPath");

    // Then
    Assert.Equal(Context.Environment.ApplicationRoot.FullPath, arg.FullPath);
});

Task("Cake.Common.ArgumentAliases.Argument.FilePathArgument")
    .Does(() =>
{
    // Given
    var testAssemblyPath = Context
                            .Environment
                            .ApplicationRoot
                            .CombineWithFilePath(
#if NETCOREAPP
                                "Cake.dll"
#else
                                "Cake.exe"
#endif
                            );

    // When
    var arg = Argument<FilePath>("testAssemblyFilePath");

    // Then
    Assert.Equal(testAssemblyPath.FullPath, arg.FullPath);
});

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Common.ArgumentAliases")
  .IsDependentOn("Cake.Common.ArgumentAliases.HasArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.HasArgument.ThatDoNotExist")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.WithDefaultValue")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.MultipleArguments")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.DirectoryPathArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.FilePathArgument")
;

#load "./../utilities/xunit.cake"

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Common.ArgumentAliases.HasArgument")
    .Does(() =>
{
    // Given, When
    var arg = HasArgument("customarg");

    // Then
    Assert.True(arg);
});

Task("Cake.Common.ArgumentAliases.HasArgument.ThatDoNotExist")
    .Does(() =>
{
    // Given, When
    var arg = HasArgument("nonexisting");

    // Then
    Assert.False(arg);
});

Task("Cake.Common.ArgumentAliases.Argument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<string>("customarg");

    // Then
    Assert.Equal("hello", arg);
});

Task("Cake.Common.ArgumentAliases.Argument.WithDefaultValue")
    .Does(() =>
{
    // Given, When
    var arg = Argument<string>("nonexisting", "foo");

    // Then
    Assert.Equal("foo", arg);
});

Task("Cake.Common.ArgumentAliases.Argument.MultipleArguments")
    .Does(() =>
{

    // Given, When
    var arg = Arguments<string>("multipleargs");

    // Then
    Assert.Equal(new[] { "a", "b" }, arg);
});

Task("Cake.Common.ArgumentAliases.Argument.MultipleArguments.WithSingleDefaultValue")
    .Does(() =>
{
    // Given
    var expect = new[] { "a" };

    // When
    var arg = Arguments<string>("nonexistingmultipleargs", expect[0]);

    // Then
    Assert.Equal(expect, arg);
});

Task("Cake.Common.ArgumentAliases.Argument.MultipleArguments.WithMultipleDefaultValue")
    .Does(() =>
{
    // Given
    var expect = new[] { "a", "b" };

    // When
    var arg = Arguments<string>("nonexistingmultipleargs", expect);

    // Then
    Assert.Equal(expect, arg);
});

Task("Cake.Common.ArgumentAliases.Argument.MultipleArguments.WithLazyDefaultValue")
    .Does(() =>
{
    // Given
    var expect = new[] { "a", "b" };

    // When
    var arg = Arguments<string>("nonexistingmultipleargs", _ => expect);

    // Then
    Assert.Equal(expect, arg);
});

Task("Cake.Common.ArgumentAliases.Argument.DirectoryPathArgument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<DirectoryPath>("testAssemblyDirectoryPath");

    // Then
    Assert.Equal(Context.Environment.ApplicationRoot.FullPath, arg.FullPath);
});

Task("Cake.Common.ArgumentAliases.Argument.FilePathArgument")
    .Does(() =>
{
    // Given
    var testAssemblyPath = Context
                            .Environment
                            .ApplicationRoot
                            .CombineWithFilePath("Cake.dll");

    // When
    var arg = Argument<FilePath>("testAssemblyFilePath");

    // Then
    Assert.Equal(testAssemblyPath.FullPath, arg.FullPath);
});

Task("Cake.Common.ArgumentAliases.Argument.DotNetCoreVerbosityArgument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<DotNetCoreVerbosity>("testDotNetCoreVerbosity");

    // Then
    Assert.Equal(DotNetCoreVerbosity.Diagnostic, arg);
});

Task("Cake.Common.ArgumentAliases.Argument.DotNetCoreRollForwardArgument")
    .Does(() =>
{
    // Given, When
    var arg = Argument<DotNetCoreRollForward>("testDotNetRollForward");

    // Then
    Assert.Equal(DotNetCoreRollForward.LatestMajor, arg);
});

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Common.ArgumentAliases")
  .IsDependentOn("Cake.Common.ArgumentAliases.HasArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.HasArgument.ThatDoNotExist")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.WithDefaultValue")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.MultipleArguments")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.MultipleArguments.WithSingleDefaultValue")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.MultipleArguments.WithMultipleDefaultValue")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.MultipleArguments.WithLazyDefaultValue")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.DirectoryPathArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.FilePathArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.DotNetCoreVerbosityArgument")
  .IsDependentOn("Cake.Common.ArgumentAliases.Argument.DotNetCoreRollForwardArgument")
;

// Utilities
#load "./utilities/paths.cake"
#load "./utilities/xunit.cake"
#load "./utilities/context.cake"

// Tests
#load "setup.cake"
#load "teardown.cake"
#load "./Cake.Common/ArgumentAliases.cake"
#load "./Cake.Common/EnvironmentAliases.cake"
#load "./Cake.Common/Diagnostics/LoggingAliases.cake"
#load "./Cake.Common/IO/DirectoryAliases.cake"
#load "./Cake.Common/IO/FileAliases.cake"
#load "./Cake.Common/IO/FileAsync.cake"
#load "./Cake.Common/IO/ZipAliases.cake"
#load "./Cake.Common/ReleaseNotesAliases.cake"
#load "./Cake.Common/Security/SecurityAliases.cake"
#load "./Cake.Common/Solution/SolutionAliases.cake"
#load "./Cake.Common/Solution/Project/ProjectAliases.cake"
#load "./Cake.Common/Solution/Project/Properties/AssemblyInfoAliases.cake"
#load "./Cake.Common/Solution/Project/XmlDoc/XmlDocAliases.cake"
#load "./Cake.Common/Text/TextTransformationAliases.cake"
#load "./Cake.Common/Tools/Cake/CakeAliases.cake"
#load "./Cake.Common/Tools/DotNetCore/DotNetCoreAliases.cake"
#load "./Cake.Common/Tools/NuGet/NuGetAliases.cake"
#load "./Cake.Core/Scripting/AddinDirective.cake"
#load "./Cake.Core/Scripting/DefineDirective.cake"
#load "./Cake.Core/Scripting/LoadDirective.cake"
#load "./Cake.Core/Scripting/SystemCollections.cake"
#load "./Cake.Core/Scripting/UsingDirective.cake"
#load "./Cake.Core/Tooling/ToolLocator.cake"
#load "./Cake.Core/CakeAliases.cake"

//////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////

var target = Argument<string>("target", "Run-All-Tests");

//////////////////////////////////////////////////
// TARGETS
//////////////////////////////////////////////////

Task("Cake.Core")
    .IsDependentOn("Cake.Core.Scripting.AddinDirective")
    .IsDependentOn("Cake.Core.Scripting.DefineDirective")
    .IsDependentOn("Cake.Core.Scripting.LoadDirective")
    .IsDependentOn("Cake.Core.Scripting.SystemCollections")
    .IsDependentOn("Cake.Core.Scripting.UsingDirective")
    .IsDependentOn("Cake.Core.Tooling.ToolLocator")
    .IsDependentOn("Cake.Core.CakeAliases");

Task("Cake.Common")
    .IsDependentOn("Cake.Common.ArgumentAliases")
    .IsDependentOn("Cake.Common.EnvironmentAliases")
    .IsDependentOn("Cake.Common.Diagnostics.LoggingAliases")
    .IsDependentOn("Cake.Common.IO.DirectoryAliases")
    .IsDependentOn("Cake.Common.IO.FileAliases")
    .IsDependentOn("Cake.Common.IO.FileAsync")
    .IsDependentOn("Cake.Common.IO.ZipAliases")
    .IsDependentOn("Cake.Common.ReleaseNotesAliases")
    .IsDependentOn("Cake.Common.Security.SecurityAliases")
    .IsDependentOn("Cake.Common.Solution.SolutionAliases")
    .IsDependentOn("Cake.Common.Solution.Project.ProjectAliases")
    .IsDependentOn("Cake.Common.Solution.Project.Properties.AssemblyInfoAliases")
    .IsDependentOn("Cake.Common.Solution.Project.XmlDoc.XmlDocAliases")
    .IsDependentOn("Cake.Common.Text.TextTransformationAliases")
    .IsDependentOn("Cake.Common.Tools.Cake.CakeAliases")
    .IsDependentOn("Cake.Common.Tools.DotNetCore.DotNetCoreAliases")
    .IsDependentOn("Cake.Common.Tools.NuGet.NuGetAliases");

Task("Run-All-Tests")
    .IsDependentOn("Setup-Tests")
    .IsDependentOn("Cake.Core")
    .IsDependentOn("Cake.Common");

//////////////////////////////////////////////////

RunTarget(target);

// Utilities
#load "./utilities/paths.cake"
#load "./utilities/xunit.cake"
#load "./utilities/context.cake"

// Tests
#load "setup.cake"
#load "teardown.cake"
#load "./Cake.Common/ArgumentAliases.cake"
#load "./Cake.Common/EnvironmentAliases.cake"
#load "./Cake.Common/Diagnostics/LoggingAliases.cake"
#load "./Cake.Common/IO/DirectoryAliases.cake"
#load "./Cake.Common/IO/FileAliases.cake"
#load "./Cake.Common/IO/FileAsync.cake"
#load "./Cake.Common/IO/GlobbingAliases.cake"
#load "./Cake.Common/IO/ZipAliases.cake"
#load "./Cake.Common/ProcessAliases.cake"
#load "./Cake.Common/ReleaseNotesAliases.cake"
#load "./Cake.Common/Security/SecurityAliases.cake"
#load "./Cake.Common/Solution/SolutionAliases.cake"
#load "./Cake.Common/Solution/Project/ProjectAliases.cake"
#load "./Cake.Common/Solution/Project/Properties/AssemblyInfoAliases.cake"
#load "./Cake.Common/Solution/Project/XmlDoc/XmlDocAliases.cake"
#load "./Cake.Common/Text/TextTransformationAliases.cake"
#load "./Cake.Common/Tools/Cake/CakeAliases.cake"
#load "./Cake.Common/Tools/DotNetCore/DotNetCoreAliases.cake"
#load "./Cake.Common/Tools/NuGet/NuGetAliases.cake"
#load "./Cake.Common/Tools/TextTransform/TextTransformAliases.cake"
#load "./Cake.Core/Diagnostics/ICakeLog.cake"
#load "./Cake.Core/Scripting/AddinDirective.cake"
#load "./Cake.Core/Scripting/DefineDirective.cake"
#load "./Cake.Core/Scripting/Dynamic.cake"
#load "./Cake.Core/Scripting/HttpClient.cake"
#load "./Cake.Core/Scripting/LoadDirective.cake"
#load "./Cake.Core/Scripting/SystemCollections.cake"
#load "./Cake.Core/Scripting/UsingDirective.cake"
#load "./Cake.Core/Scripting/SpectreConsole.cake"
#load "./Cake.Core/Tooling/ToolLocator.cake"
#load "./Cake.Core/CakeAliases.cake"
#load "./Cake.DotNetTool.Module/Cake.DotNetTool.Module.cake"
#load "./Cake.NuGet/InProcessInstaller.cake"

//////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////

var target = Argument<string>("target", "Run-All-Tests");

//////////////////////////////////////////////////
// TARGETS
//////////////////////////////////////////////////

Task("Cake.Core")
    .IsDependentOn("Cake.Core.Diagnostics")
    .IsDependentOn("Cake.Core.Scripting.AddinDirective")
    .IsDependentOn("Cake.Core.Scripting.DefineDirective")
    .IsDependentOn("Cake.Core.Scripting.Dynamic")
    .IsDependentOn("Cake.Core.Scripting.HttpClient")
    .IsDependentOn("Cake.Core.Scripting.LoadDirective")
    .IsDependentOn("Cake.Core.Scripting.SystemCollections")
    .IsDependentOn("Cake.Core.Scripting.UsingDirective")
    .IsDependentOn("Cake.Core.Scripting.Spectre.Console")
    .IsDependentOn("Cake.Core.Tooling.ToolLocator")
    .IsDependentOn("Cake.Core.CakeAliases");

Task("Cake.Common")
    .IsDependentOn("Cake.Common.ArgumentAliases")
    .IsDependentOn("Cake.Common.EnvironmentAliases")
    .IsDependentOn("Cake.Common.Diagnostics.LoggingAliases")
    .IsDependentOn("Cake.Common.IO.DirectoryAliases")
    .IsDependentOn("Cake.Common.IO.FileAliases")
    .IsDependentOn("Cake.Common.IO.FileAsync")
    .IsDependentOn("Cake.Common.IO.GlobbingAliases")
    .IsDependentOn("Cake.Common.IO.ZipAliases")
    .IsDependentOn("Cake.Common.ProcessAliases")
    .IsDependentOn("Cake.Common.ReleaseNotesAliases")
    .IsDependentOn("Cake.Common.Security.SecurityAliases")
    .IsDependentOn("Cake.Common.Solution.SolutionAliases")
    .IsDependentOn("Cake.Common.Solution.Project.ProjectAliases")
    .IsDependentOn("Cake.Common.Solution.Project.Properties.AssemblyInfoAliases")
    .IsDependentOn("Cake.Common.Solution.Project.XmlDoc.XmlDocAliases")
    .IsDependentOn("Cake.Common.Text.TextTransformationAliases")
    .IsDependentOn("Cake.Common.Tools.Cake.CakeAliases")
    .IsDependentOn("Cake.Common.Tools.DotNetCore.DotNetCoreAliases")
    .IsDependentOn("Cake.Common.Tools.NuGet.NuGetAliases")
    .IsDependentOn("Cake.Common.Tools.TextTransform.TextTransformAliases");

Task("Cake.NuGet")
    .IsDependentOn("Cake.NuGet.InProcessInstaller");

Task("Run-All-Tests")
    .IsDependentOn("Setup-Tests")
    .IsDependentOn("Cake.Core")
    .IsDependentOn("Cake.Common")
    .IsDependentOn("Cake.DotNetTool.Module")
    .IsDependentOn("Cake.NuGet");

//////////////////////////////////////////////////

RunTarget(target);

// Utilities
#load "./utilities/paths.cake"
#load "./utilities/xunit.cake"
#load "./utilities/context.cake"

// Tests
#load "setup.cake"
#load "teardown.cake"
#load "./Cake.Common/ArgumentAliases.cake"
#load "./Cake.Common/Build/BuildSystemAliases.cake"
#load "./Cake.Common/EnvironmentAliases.cake"
#load "./Cake.Common/Diagnostics/LoggingAliases.cake"
#load "./Cake.Common/IO/DirectoryAliases.cake"
#load "./Cake.Common/IO/FileAliases.cake"
#load "./Cake.Common/IO/FileAsync.cake"
#load "./Cake.Common/IO/GlobbingAliases.cake"
#load "./Cake.Common/IO/ZipAliases.cake"
#load "./Cake.Common/ProcessAliases.cake"
#load "./Cake.Common/ReleaseNotesAliases.cake"
#load "./Cake.Common/Security/SecurityAliases.cake"
#load "./Cake.Common/Solution/SolutionAliases.cake"
#load "./Cake.Common/Solution/Project/ProjectAliases.cake"
#load "./Cake.Common/Solution/Project/Properties/AssemblyInfoAliases.cake"
#load "./Cake.Common/Solution/Project/XmlDoc/XmlDocAliases.cake"
#load "./Cake.Common/Text/TextTransformationAliases.cake"
#load "./Cake.Common/Tools/Cake/CakeAliases.cake"
#load "./Cake.Common/Tools/DotNet/DotNetAliases.cake"
#load "./Cake.Common/Tools/DotNetCore/DotNetCoreAliases.cake"
#load "./Cake.Common/Tools/NuGet/NuGetAliases.cake"
#load "./Cake.Common/Tools/TextTransform/TextTransformAliases.cake"
#load "./Cake.Core/Diagnostics/ICakeLog.cake"
#load "./Cake.Core/IO/Path.cake"
#load "./Cake.Core/Scripting/AddinDirective.cake"
#load "./Cake.Core/Scripting/DefineDirective.cake"
#load "./Cake.Core/Scripting/Dynamic.cake"
#load "./Cake.Core/Scripting/HttpClient.cake"
#load "./Cake.Core/Scripting/LoadDirective.cake"
#load "./Cake.Core/Scripting/SystemCollections.cake"
#load "./Cake.Core/Scripting/UsingDirective.cake"
#load "./Cake.Core/Scripting/SpectreConsole.cake"
#load "./Cake.Core/Tooling/ToolLocator.cake"
#load "./Cake.Core/CakeAliases.cake"
#load "./Cake.DotNetTool.Module/Cake.DotNetTool.Module.cake"
#load "./Cake.NuGet/InProcessInstaller.cake"

//////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////

var target = Argument<string>("target", "Run-All-Tests");

//////////////////////////////////////////////////
// TARGETS
//////////////////////////////////////////////////

Task("Cake.Core")
    .IsDependentOn("Cake.Core.Diagnostics")
    .IsDependentOn("Cake.Core.IO.Path")
    .IsDependentOn("Cake.Core.Scripting.AddinDirective")
    .IsDependentOn("Cake.Core.Scripting.DefineDirective")
    .IsDependentOn("Cake.Core.Scripting.Dynamic")
    .IsDependentOn("Cake.Core.Scripting.HttpClient")
    .IsDependentOn("Cake.Core.Scripting.LoadDirective")
    .IsDependentOn("Cake.Core.Scripting.SystemCollections")
    .IsDependentOn("Cake.Core.Scripting.UsingDirective")
    .IsDependentOn("Cake.Core.Scripting.Spectre.Console")
    .IsDependentOn("Cake.Core.Tooling.ToolLocator")
    .IsDependentOn("Cake.Core.CakeAliases");

Task("Cake.Common")
    .IsDependentOn("Cake.Common.ArgumentAliases")
    .IsDependentOn("Cake.Common.Build.BuildSystemAliases")
    .IsDependentOn("Cake.Common.EnvironmentAliases")
    .IsDependentOn("Cake.Common.Diagnostics.LoggingAliases")
    .IsDependentOn("Cake.Common.IO.DirectoryAliases")
    .IsDependentOn("Cake.Common.IO.FileAliases")
    .IsDependentOn("Cake.Common.IO.FileAsync")
    .IsDependentOn("Cake.Common.IO.GlobbingAliases")
    .IsDependentOn("Cake.Common.IO.ZipAliases")
    .IsDependentOn("Cake.Common.ProcessAliases")
    .IsDependentOn("Cake.Common.ReleaseNotesAliases")
    .IsDependentOn("Cake.Common.Security.SecurityAliases")
    .IsDependentOn("Cake.Common.Solution.SolutionAliases")
    .IsDependentOn("Cake.Common.Solution.Project.ProjectAliases")
    .IsDependentOn("Cake.Common.Solution.Project.Properties.AssemblyInfoAliases")
    .IsDependentOn("Cake.Common.Solution.Project.XmlDoc.XmlDocAliases")
    .IsDependentOn("Cake.Common.Text.TextTransformationAliases")
    .IsDependentOn("Cake.Common.Tools.Cake.CakeAliases")
    .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases")
    .IsDependentOn("Cake.Common.Tools.DotNetCore.DotNetCoreAliases")
    .IsDependentOn("Cake.Common.Tools.NuGet.NuGetAliases")
    .IsDependentOn("Cake.Common.Tools.TextTransform.TextTransformAliases");

Task("Cake.NuGet")
    .IsDependentOn("Cake.NuGet.InProcessInstaller");

Task("Run-All-Tests")
    .IsDependentOn("Setup-Tests")
    .IsDependentOn("Cake.Core")
    .IsDependentOn("Cake.Common")
    .IsDependentOn("Cake.DotNetTool.Module")
    .IsDependentOn("Cake.NuGet");

//////////////////////////////////////////////////

RunTarget(target);


        [Fact]
        public async Task ShouldSupportLoadedFiles()
        {
            using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false))
            using (var host = CreateOmniSharpHost(testProject.Directory))
            {
                var fileName = Path.Combine(testProject.Directory, "build.cake");

                var request = new GotoDefinitionRequest
                {
                    FileName = fileName,
                    Line = 8,
                    Column = 10
                };

                var requestHandler = GetRequestHandler(host);
                var response = await requestHandler.Handle(request);

                Assert.NotNull(response.Definitions);
                Assert.Single(response.Definitions);
                var definition = response.Definitions.Single();

                Assert.Equal(Path.Combine(testProject.Directory, "foo.cake"), definition.Location.FileName);
                Assert.Equal(4, definition.Location.Range.Start.Line);
                Assert.Equal(22, definition.Location.Range.Start.Column);
            }
        }

        [Fact]
        public async Task ShouldNavigateToAProperty()
        {
            using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false))
            using (var host = CreateOmniSharpHost(testProject.Directory))
            {
                var fileName = Path.Combine(testProject.Directory, "build.cake");

                var request = new GotoDefinitionRequest
                {
                    FileName = fileName,
                    Line = 11,
                    Column = 20
                };

                var requestHandler = GetRequestHandler(host);
                var response = await requestHandler.Handle(request);

                Assert.NotNull(response.Definitions);
                Assert.Single(response.Definitions);
                var definition = response.Definitions.Single();

                Assert.Equal(Path.Combine(testProject.Directory, "foo.cake"), definition.Location.FileName);
                Assert.Equal(0, definition.Location.Range.Start.Line);
                Assert.Equal(4, definition.Location.Range.Start.Column);
            }
        }

        [Fact]
        public async Task ShouldNavigateIntoDslMetadataWithoutGenericParams()
        {
            using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false))
            using (var host = CreateOmniSharpHost(testProject.Directory))
            {
                var fileName = Path.Combine(testProject.Directory, "build.cake");

                var request = new GotoDefinitionRequest
                {
                    FileName = fileName,
                    Line = 11,
                    Column = 10,
                    WantMetadata = true
                };

                var requestHandler = GetRequestHandler(host);
                var response = await requestHandler.Handle(request);

                Assert.NotNull(response.Definitions);
                Assert.Single(response.Definitions);
                var definition = response.Definitions.Single();
                Assert.StartsWith("$metadata$", definition.Location.FileName);

                var metadata = definition.MetadataSource;
                Assert.NotNull(metadata);
                Assert.Equal("Cake.Common", metadata.AssemblyName);
                Assert.Equal("Cake.Common.Diagnostics.LoggingAliases", metadata.TypeName);
            }
        }

        [Fact]
        public async Task ShouldNavigateIntoDslMetadataWithGenericParams()
        {
            using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false))
            using (var host = CreateOmniSharpHost(testProject.Directory))
            {
                var fileName = Path.Combine(testProject.Directory, "build.cake");

                var request = new GotoDefinitionRequest
                {
                    FileName = fileName,
                    Line = 0,
                    Column = 16,
                    WantMetadata = true
                };

                var requestHandler = GetRequestHandler(host);
                var response = await requestHandler.Handle(request);

                Assert.NotNull(response.Definitions);
                Assert.Single(response.Definitions);
                var definition = response.Definitions.Single();
                Assert.StartsWith("$metadata$", definition.Location.FileName);

                var metadata = definition.MetadataSource;
                Assert.NotNull(metadata);
                Assert.Equal("Cake.Common", metadata.AssemblyName);
                Assert.Equal("Cake.Common.ArgumentAliases", metadata.TypeName);
            }
        }

        [Fact]
        public async Task ShouldNavigateIntoDslMetadataProperty()
        {
            using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false))
            using (var host = CreateOmniSharpHost(testProject.Directory))
            {
                var fileName = Path.Combine(testProject.Directory, "build.cake");

                var request = new GotoDefinitionRequest
                {
                    FileName = fileName,
                    Line = 12,
                    Column = 37,
                    WantMetadata = true
                };

                var requestHandler = GetRequestHandler(host);
                var response = await requestHandler.Handle(request);

                Assert.NotNull(response.Definitions);
                Assert.Single(response.Definitions);
                var definition = response.Definitions.Single();
                Assert.StartsWith("$metadata$", definition.Location.FileName);

                var metadata = definition.MetadataSource;
                Assert.NotNull(metadata);
                Assert.Equal("Cake.Common", metadata.AssemblyName);
                Assert.Equal("Cake.Common.Build.BuildSystemAliases", metadata.TypeName);
            }
        }

        [Fact]
        public async Task ShouldFindMultipleLocationsForPartial()
        {
            using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false))
            using (var host = CreateOmniSharpHost(testProject.Directory))
            {
                var fileName = Path.Combine(testProject.Directory, "build.cake");

                var request = new GotoDefinitionRequest
                {
                    FileName = fileName,
                    Line = 7,
                    Column = 5
                };

                var requestHandler = GetRequestHandler(host);
                var response = await requestHandler.Handle(request);

                Assert.NotNull(response.Definitions);
                var expectedFile = Path.Combine(testProject.Directory, "foo.cake");
                Assert.Collection(
                    response.Definitions,
                    d =>
                    {
                        Assert.Equal(expectedFile, d.Location.FileName);
                        Assert.Equal(2, d.Location.Range.Start.Line);
                        Assert.Equal(21, d.Location.Range.Start.Column);
                    },
                    d =>
                    {
                        Assert.Equal(expectedFile, d.Location.FileName);
                        Assert.Equal(15, d.Location.Range.Start.Line);
                        Assert.Equal(21, d.Location.Range.Start.Column);
                    });
            }
        }

        /// <summary>
        /// Determines whether or not the specified argument exist.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <returns>Whether or not the specified argument exist.</returns>
        /// <example>
        /// This sample shows how to call the <see cref="HasArgument"/> method.
        /// <code>
        /// var argumentName = "myArgument";
        /// // Cake.exe .\hasargument.cake -myArgument="is specified"
        /// if (HasArgument(argumentName))
        /// {
        ///     Information("{0} is specified", argumentName);
        /// }
        /// // Cake.exe .\hasargument.cake
        /// else
        /// {
        ///     Warning("{0} not specified", argumentName);
        /// }
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static bool HasArgument(this ICakeContext context, string name)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            return context.Arguments.HasArgument(name);
        }

        /// <summary>
        /// Gets an argument and throws if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <returns>The value of the argument.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --myArgument="is valid" --loopCount=5
        /// Information("Argument {0}", Argument&lt;string&gt;("myArgument"));
        /// var loopCount = Argument&lt;int&gt;("loopCount");
        /// for(var index = 0;index&lt;loopCount; index++)
        /// {
        ///     Information("Index {0}", index);
        /// }
        /// </code>
        /// </example>
        /// <exception cref="CakeException">Argument value is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="context"/> is null.</exception>
        [CakeMethodAlias]
        public static T Argument<T>(this ICakeContext context, string name)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var value = context.Arguments.GetArguments(name).FirstOrDefault();
            if (value == null)
            {
                const string format = "Argument '{0}' was not set.";
                var message = string.Format(CultureInfo.InvariantCulture, format, name);
                throw new CakeException(message);
            }

            return Convert<T>(value);
        }

        /// <summary>
        /// Gets all arguments with the specific name and throws if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <returns>The argument values.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --foo="foo" --foo="bar"
        /// var arguments = Arguments&lt;string&gt;("foo");
        /// Information("Arguments: {0}", string.Join(", ", arguments));
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static ICollection<T> Arguments<T>(this ICakeContext context, string name)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var values = context.Arguments.GetArguments(name);
            if (values == null || values.Count == 0)
            {
                const string format = "Argument '{0}' was not set.";
                var message = string.Format(CultureInfo.InvariantCulture, format, name);
                throw new CakeException(message);
            }

            return values.Select(value => Convert<T>(value)).ToArray();
        }

        /// <summary>
        /// Gets all arguments with the specific name and returns the
        /// provided <paramref name="defaultValue"/> if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="defaultValue">The value to return if the argument is missing.</param>
        /// <returns>The argument values.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --foo="foo" --foo="bar"
        /// var arguments = Arguments&lt;string&gt;("foo", "default");
        /// Information("Arguments: {0}", string.Join(", ", arguments));
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static ICollection<T> Arguments<T>(this ICakeContext context, string name, T defaultValue)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var values = context.Arguments.GetArguments(name);
            if (values == null || values.Count == 0)
            {
                return new T[] { defaultValue };
            }

            return values.Select(value => Convert<T>(value)).ToArray();
        }

        /// <summary>
        /// Gets an argument and returns the provided <paramref name="defaultValue"/> if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="defaultValue">The value to return if the argument is missing.</param>
        /// <returns>The value of the argument if it exist; otherwise <paramref name="defaultValue"/>.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --myArgument="is valid" --loopCount=5
        /// Information("Argument {0}", Argument&lt;string&gt;("myArgument", "is NOT valid"));
        /// var loopCount = Argument&lt;int&gt;("loopCount", 10);
        /// for(var index = 0;index&lt;loopCount; index++)
        /// {
        ///     Information("Index {0}", index);
        /// }
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static T Argument<T>(this ICakeContext context, string name, T defaultValue)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var value = context.Arguments.GetArguments(name)?.FirstOrDefault();
            return value == null
                ? defaultValue
                : Convert<T>(value);
        }

        /// <summary>
        /// Retrieves all command line arguments.
        /// </summary>
        /// <example>
        /// <code>
        /// var args = context.Arguments();
        ///
        /// if (args.ContainsKey("verbose"))
        /// {
        ///     Information("Verbose output enabled");
        /// }
        ///
        /// foreach(var arg in args)
        /// {
        ///     Information(
        ///         "Key: {0}\tValue: \"{1}\"",
        ///         arg.Key,
        ///         string.Join(";", arg.Value)
        ///         );
        /// }
        /// </code>
        /// </example>
        /// <param name="context">The context.</param>
        /// <returns>The command line arguments.</returns>
        [CakeMethodAlias]
        public static IDictionary<string, ICollection<string>> Arguments(this ICakeContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            return context.Arguments.GetArguments();
        }

        /// <summary>
        /// Determines whether or not the specified argument exist.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <returns>Whether or not the specified argument exist.</returns>
        /// <example>
        /// This sample shows how to call the <see cref="HasArgument"/> method.
        /// <code>
        /// var argumentName = "myArgument";
        /// // Cake.exe .\hasargument.cake -myArgument="is specified"
        /// if (HasArgument(argumentName))
        /// {
        ///     Information("{0} is specified", argumentName);
        /// }
        /// // Cake.exe .\hasargument.cake
        /// else
        /// {
        ///     Warning("{0} not specified", argumentName);
        /// }
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static bool HasArgument(this ICakeContext context, string name)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            return context.Arguments.HasArgument(name);
        }

        /// <summary>
        /// Gets an argument and throws if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <returns>The value of the argument.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --myArgument="is valid" --loopCount=5
        /// Information("Argument {0}", Argument&lt;string&gt;("myArgument"));
        /// var loopCount = Argument&lt;int&gt;("loopCount");
        /// for(var index = 0;index&lt;loopCount; index++)
        /// {
        ///     Information("Index {0}", index);
        /// }
        /// </code>
        /// </example>
        /// <exception cref="CakeException">Argument value is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="context"/> is null.</exception>
        [CakeMethodAlias]
        public static T Argument<T>(this ICakeContext context, string name)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var value = context.Arguments.GetArguments(name).FirstOrDefault();
            if (value == null)
            {
                const string format = "Argument '{0}' was not set.";
                var message = string.Format(CultureInfo.InvariantCulture, format, name);
                throw new CakeException(message);
            }

            return Convert<T>(value);
        }

        /// <summary>
        /// Gets all arguments with the specific name and throws if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <returns>The argument values.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --foo="foo" --foo="bar"
        /// var arguments = Arguments&lt;string&gt;("foo");
        /// Information("Arguments: {0}", string.Join(", ", arguments));
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static ICollection<T> Arguments<T>(this ICakeContext context, string name)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var values = context.Arguments.GetArguments(name);
            if (values == null || values.Count == 0)
            {
                const string format = "Argument '{0}' was not set.";
                var message = string.Format(CultureInfo.InvariantCulture, format, name);
                throw new CakeException(message);
            }

            return values.Select(value => Convert<T>(value)).ToArray();
        }

        /// <summary>
        /// Gets all arguments with the specific name and returns the
        /// provided <paramref name="defaultValue"/> if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="defaultValue">The value to return if the argument is missing.</param>
        /// <returns>The argument values.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --foo="foo" --foo="bar"
        /// var arguments = Arguments&lt;string&gt;("foo", "default");
        /// Information("Arguments: {0}", string.Join(", ", arguments));
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static ICollection<T> Arguments<T>(this ICakeContext context, string name, T defaultValue)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var values = context.Arguments.GetArguments(name);
            if (values == null || values.Count == 0)
            {
                return new T[] { defaultValue };
            }

            return values.Select(value => Convert<T>(value)).ToArray();
        }

        /// <summary>
        /// Gets all arguments with the specific name and returns the
        /// provided <paramref name="defaultValues"/> if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="defaultValues">The values to return if the argument is missing.</param>
        /// <returns>The argument values.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --foo="foo" --foo="bar"
        /// var arguments = Arguments&lt;string&gt;("foo", new [] { "default" });
        /// Information("Arguments: {0}", string.Join(", ", arguments));
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static ICollection<T> Arguments<T>(this ICakeContext context, string name, ICollection<T> defaultValues)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var values = context.Arguments.GetArguments(name);
            if (values == null || values.Count == 0)
            {
                return defaultValues;
            }

            return values.Select(value => Convert<T>(value)).ToArray();
        }

        /// <summary>
        /// Gets all arguments with the specific name, evaluates and returns the
        /// provided <paramref name="defaultValues"/> if the argument is missing.
        /// </summary>
        /// <typeparam name="T">The argument type.</typeparam>
        /// <param name="context">The context.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="defaultValues">The values to return if the argument is missing.</param>
        /// <returns>The argument values.</returns>
        /// <example>
        /// <code>
        /// // Cake.exe .\argument.cake --foo="foo" --foo="bar"
        /// var arguments = Arguments&lt;string&gt;("foo", ctx => new [] { "default" });
        /// Information("Arguments: {0}", string.Join(", ", arguments));
        /// </code>
        /// </example>
        [CakeMethodAlias]
        public static ICollection<T> Arguments<T>(this ICakeContext context, string name, Func<ICakeContext, ICollection<T>> defaultValues)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var values = context.Arguments.GetArguments(name);
            if (values == null || values.Count == 0)
            {
                return defaultValues?.Invoke(context);
            }

            return values.Select(value => Convert<T>(value)).ToArray();
        }

Cake.Common.ArgumentAliases : Object

Methods :

public static Boolean HasArgument(ICakeContext context = , String name = )
public static T Argument(ICakeContext context = , String name = )
public static ICollection<T> Arguments(ICakeContext context = , String name = )
public static ICollection<T> Arguments(ICakeContext context = , String name = , T defaultValue = )
public static ICollection<T> Arguments(ICakeContext context = , String name = , ICollection<T> defaultValues = )
public static ICollection<T> Arguments(ICakeContext context = , String name = , Func<ICakeContext, ICollection<T>> defaultValues = )
public static T Argument(ICakeContext context = , String name = , T defaultValue = )
public static IDictionary<String, ICollection<String>> Arguments(ICakeContext context = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()