public void DoFilePathBindFileDoesNotExistTest()
        {
            // Setup
            const string requiredArgValue = "somewhere.txt";
            const string optionalArgValue = "someplace.txt";
            const string nullArgValue     = "a thing.txt";

            string[] arguments = new string[]
            {
                $"--target={nameof( FilePathBindTask )}",
                $"--{FilePathBind.RequiredArgName}=\"{requiredArgValue}\"",
                $"--{FilePathBind.OptionalArgName}=\"{optionalArgValue}\"",
                $"--{FilePathBind.NullArgName}={nullArgValue}",
                $"--{FilePathBind.MustExistArgName}=\"{exePath}.txt\"" // <-.txt to exe makes it not exist.
            };

            // Act
            int exitCode = CakeFrostingRunner.TryRunCake(arguments);

            // Check
            Assert.NotZero(exitCode);
            Assert.NotNull(foundException);
            Assert.IsTrue(foundException is AggregateException);

            AggregateException ex = (AggregateException)foundException;

            Assert.AreEqual(1, ex.InnerExceptions.Count);
            Assert.IsTrue(ex.InnerExceptions[0] is FileNotFoundException);
        }
        public void DoBooleanBindBindRequiredArgMissingTest()
        {
            // Setup
            string[] arguments = new string[]
            {
                $"--target={nameof( BooleanEnvironmentVariableBindTask )}",
            };

            // Act
            int exitCode = CakeFrostingRunner.TryRunCake(arguments);

            // Check
            Assert.NotZero(exitCode);
            Assert.NotNull(foundException);
            Assert.IsTrue(foundException is AggregateException);

            AggregateException ex = (AggregateException)foundException;

            Assert.AreEqual(1, ex.InnerExceptions.Count);
            Assert.IsTrue(ex.InnerExceptions[0] is MissingRequiredArgumentException);
        }
        public void DoIntegerBindRequiredAboveMaxTest()
        {
            // Setup
            string[] arguments = new string[]
            {
                $"--target={nameof( IntegerBindTest )}",
                $"--{IntegerBind.RequiredArgName}={IntegerBind.RequiredArgMaxValue + 1}",
            };

            // Act
            int exitCode = CakeFrostingRunner.TryRunCake(arguments);

            // Check
            Assert.NotZero(exitCode);
            Assert.NotNull(foundException);
            Assert.IsTrue(foundException is AggregateException);

            AggregateException ex = (AggregateException)foundException;

            Assert.AreEqual(1, ex.InnerExceptions.Count);
            Assert.IsTrue(ex.InnerExceptions[0] is ArgumentTooLargeException);
        }
        public void DoFilePathBindRequiredArgMissingTest()
        {
            // Setup
            string[] arguments = new string[]
            {
                $"--target={nameof( FilePathBindTask )}",
            };

            // Act
            int exitCode = CakeFrostingRunner.TryRunCake(arguments);

            // Check
            Assert.NotZero(exitCode);
            Assert.NotNull(foundException);
            Assert.IsTrue(foundException is AggregateException);

            AggregateException ex = (AggregateException)foundException;

            // 2 Missing arguments should result in 2 exceptions.
            Assert.AreEqual(2, ex.InnerExceptions.Count);
            Assert.IsTrue(ex.InnerExceptions[0] is MissingRequiredArgumentException);
            Assert.IsTrue(ex.InnerExceptions[1] is MissingRequiredArgumentException);
        }