public static IEnumerable <object[]> GetTestArgumentProcessingTestCases()
        {
            // Current method return 'test case' information that contains two arguments for TestArgumentProcessing method:
            // literal to parse and factory method that will return an argument.
            // This factory can't return Argument instance because to create an instance FrontEndContextCore is required.
            // But front end context is test-specific and belong to the current instance.

            //
            // Scalar + primitive value test cases
            //
            yield return(TestCase(
                             @"export const x = {name: ""foo"", value: 42};",
                             (context) => Cmd.Option("foo", 42)));

            yield return(TestCase(
                             @"export const x = {name: ""foo"", value: ""42""};",
                             (context) => Cmd.Option("foo", "42")));

            yield return(TestCase(
                             @"export const x = {name: undefined, value: ""42""};",
                             (context) => Cmd.Option(null, "42")));

            yield return(TestCase(
                             @"export const x = {value: ""42""};",
                             (context) => Cmd.Argument("42")));

            //
            // Scalar + FileArtifact test cases
            //
            yield return(TestCase(
                             WrapWithArtifactKind(String.Format(@"export const x = {{name: ""scalar1"", value: {{kind: ArtifactKind.output, path: p`{0}foo.cs`}}}};", m_testAbsolutePath)),
                             (context) => Cmd.Option("scalar1", Artifacts.Output(CreateAbsolutePath(context, String.Format("{0}foo.cs", m_testAbsolutePath))))));

            yield return(TestCase(
                             WrapWithArtifactKind(String.Format(@"export const x = {{name: ""scalar2"", value: {{kind: ArtifactKind.input, path: p`{0}foo`}}}};", m_testAbsolutePath)),
                             (context) => Cmd.Option("scalar2", Artifacts.Input(CreateAbsolutePath(context, String.Format("{0}foo", m_testAbsolutePath))))));

            //
            // PrimitiveArgument test cases
            //
            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""prim1"", value: {kind: ArgumentKind.rawText, value: ""text""}};"),
                             (context) => Cmd.RawText("prim1", "text")));

            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""prim2"", value: {kind: ArgumentKind.regular, value: 42}};"),
                             (context) => Cmd.RegularOption("prim2", 42)));

            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: undefined, value: {kind: ArgumentKind.startUsingResponseFile, value: undefined}};"),
                             (context) => Cmd.StartUsingResponseFile()));

            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""@"", value: {kind: ArgumentKind.startUsingResponseFile, value: ""true""}};"),
                             (context) => Cmd.StartUsingResponseFile("@", true)));

            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""prim4"", value: {kind: ArgumentKind.flag, value: undefined}};"),
                             (context) => Cmd.Flag("prim4")));

            //
            // ScalarArgument[] test cases
            //
            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""array1"", value: [42, ""42"", {kind: ArgumentKind.regular, value: 42}]};"),
                             (context) => Cmd.Options(
                                 "array1",
                                 ArgumentValue.FromNumber(42),
                                 ArgumentValue.FromString("42"),
                                 ArgumentValue.FromPrimitive(ArgumentKind.Regular, new PrimitiveValue(42)))));

            yield return(TestCase(
                             WrapWithArtifactKind(String.Format(@"export const x = {{name: ""array2"", value: [{{kind: ArtifactKind.output, path: p`{0}foo.cs`}}]}};", m_testAbsolutePath)),
                             (context) => Cmd.Options(
                                 "array2",
                                 Artifacts.Output(CreateAbsolutePath(context, String.Format("{0}foo.cs", m_testAbsolutePath))))));

            //
            // ListArgument test cases
            //

            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""list2"", value: {separator: "","", values: []}};"),
                             (context) => Cmd.Option("list2", Cmd.Join(",", new ArgumentValue[0]))));

            yield return(TestCase(
                             WrapWithArgumentKind(@"export const x = {name: ""list3"", value: {separator: "","", values: [1, 2, ""42""]}};"),
                             (context) => Cmd.Option(
                                 "list3",
                                 Cmd.Join(
                                     ",",
                                     new[]
            {
                ArgumentValue.FromNumber(1),
                ArgumentValue.FromNumber(2),
                ArgumentValue.FromString("42")
            }))));

            yield return(TestCase(
                             WrapWithArtifactKindAndArgumentKind(
                                 String.Format(@"export const x = {{name: ""list4"", value: {{separator: "","", values: [1, {{kind: ArtifactKind.output, path: p`{0}foo.cs`}}]}}}};", m_testAbsolutePath)),
                             (context) => Cmd.Option(
                                 "list4",
                                 Cmd.Join(
                                     ",",
                                     new[]
            {
                ArgumentValue.FromNumber(1),
                ArgumentValue.FromAbsolutePath(ArtifactKind.Output, CreateAbsolutePath(context, String.Format("{0}foo.cs", m_testAbsolutePath)))
            }))));
        }
        public static IEnumerable <object[]> GetTestApiArgumentTestCases()
        {
            //
            // Cmd.flag + Cmd.sign
            //
            yield return(TestCase(
                             @"export const x = Cmd.flag(""/nologo"", true);",
                             (context) => Cmd.Flag("/nologo")));

            yield return(TestCase(
                             @"export const x = Cmd.option(""/timeout"", 42);",
                             (context) => Cmd.Option("/timeout", 42)));

            yield return(TestCase(
                             @"export const x = Cmd.sign(""/unsafe"", true);",
                             (context) => Cmd.Option("/unsafe", "+")));

            yield return(TestCase(
                             @"export const x = Cmd.sign(""/unsafe"", false);",
                             (context) => Cmd.Option("/unsafe", "-")));

            yield return(TestCase(
                             @"export const x = Cmd.sign(""/unsafe"", undefined);",
                             (context) => Cmd.Undefined()));

            yield return(TestCase(
                             @"export const x = Cmd.sign(""/enableNoPlus"", true, true);",
                             (context) => Cmd.Flag("/enableNoPlus")));

            yield return(TestCase(
                             @"export const x = Cmd.sign(""/enableNoPlus"", false, true);",
                             (context) => Cmd.Option("/enableNoPlus", "-")));

            //
            // Cmd.option with files
            //
            yield return(TestCase(
                             String.Format(@"export const x = Cmd.option(""/out"", Artifact.output(p`{0}foo.txt`));", m_testAbsolutePath),
                             (context) => Cmd.Option("/out", Artifacts.Output(CreateAbsolutePath(context, String.Format("{0}foo.txt", m_testAbsolutePath))))));

            yield return(TestCase(
                             String.Format(@"export const x = Cmd.option(""/input"", Artifact.input(p`{0}foo.txt`));", m_testAbsolutePath),
                             (context) => Cmd.Option("/input", Artifacts.Input(CreateAbsolutePath(context, String.Format("{0}foo.txt", m_testAbsolutePath))))));

            yield return(TestCase(
                             String.Format(@"export const x = Cmd.option(""/outFolder"", Artifact.output(p`{0}foo`));", m_testAbsolutePath),
                             (context) => Cmd.Option("/outFolder", Artifacts.Output(CreateAbsolutePath(context, String.Format("{0}foo", m_testAbsolutePath))))));

            yield return(TestCase(
                             String.Format(@"export const x = Cmd.option(""/rewrite"", Artifact.rewritten(f`{0}foo.txt`, p`{0}boo.txt`));", m_testAbsolutePath),
                             (context) =>
                             Cmd.Option("/rewrite", Artifacts.Rewritten(
                                            CreateFile(context, String.Format("{0}foo.txt", m_testAbsolutePath)),
                                            CreateAbsolutePath(context, String.Format("{0}boo.txt", m_testAbsolutePath))))));

            yield return(TestCase(
                             String.Format(@"export const x = Cmd.option(""/rewrite"", Artifact.rewritten(f`{0}foo.txt`));", m_testAbsolutePath),
                             (context) =>
                             Cmd.Option("/rewrite", Artifacts.InPlaceRewritten(CreateFile(context, String.Format("{0}foo.txt", m_testAbsolutePath))))));

            //
            // Cmd.options
            //
            yield return(TestCase(
                             String.Format(@"export const x = Cmd.options(""/crazy"", [Artifact.output(p`{0}foo.txt`), Artifact.input(p`{0}boo.txt`)]);", m_testAbsolutePath),
                             (context) =>
                             Cmd.Options("/crazy",
                                         Artifacts.Output(CreateAbsolutePath(context, String.Format("{0}foo.txt", m_testAbsolutePath))),
                                         Artifacts.Input(CreateAbsolutePath(context, String.Format("{0}boo.txt", m_testAbsolutePath))))));
        }