示例#1
0
        public void IntegerArgumentNotHiddenButRequiredTest()
        {
            // Act
            string actualDescription = ArgumentBinder.GetDescription <IntegerArgumentNotHiddenButRequired>(taskDescription);

            // Check

            // -------- Lines that should be there --------

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"--{argumentName}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                argDescription,
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.SourcePrefix}: {BaseAttribute.DefaultArgumentSource}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.TypePrefix}: {typeof( int ).Name}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{IntegerArgumentAttribute.MinValuePrefix}: {minValue}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{IntegerArgumentAttribute.MaxValuePrefix}: {maxValue}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.RequiredPrefix}: {true}",
                actualDescription
                );

            // -------- Lines that should NOT there --------

            // Required argument, default value is not needed.
            // Should not print it.
            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.DefaultValuePrefix,
                actualDescription
                );

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.ValueIsSecretPrefix,
                actualDescription
                );
        }
示例#2
0
        public void IntegerArgumentHiddenNotRequiredTest()
        {
            // Act
            string actualDescription = ArgumentBinder.GetDescription <IntegerArgumentHiddenNotRequired>(taskDescription);

            // Check

            // -------- Lines that should be there --------

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"--{argumentName}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                argDescription,
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.SourcePrefix}: {BaseAttribute.DefaultArgumentSource}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.TypePrefix}: {typeof( int ).Name}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.DefaultValuePrefix}: {ArgumentBinder.HiddenString}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{IntegerArgumentAttribute.MinValuePrefix}: {ArgumentBinder.HiddenString}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{IntegerArgumentAttribute.MaxValuePrefix}: {ArgumentBinder.HiddenString}",
                actualDescription
                );

            // -------- Lines that should NOT there --------

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.RequiredPrefix,
                actualDescription
                );
        }
        public void FilePathArgumentNotHiddenNotRequiredTest()
        {
            // Act
            string actualDescription = ArgumentBinder.GetDescription <FilePathArgumentNotHiddenNotRequiredNotExisting>(taskDescription);

            // Check

            // -------- Lines that should be there --------

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"--{argumentName}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                argDescription,
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.SourcePrefix}: {BaseAttribute.DefaultArgumentSource}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.TypePrefix}: {typeof( FilePath ).Name}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.DefaultValuePrefix}: {defaultValue}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BasePathAttribute.MustExistPrefix}: {false}",
                actualDescription
                );

            // -------- Lines that should NOT there --------

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.RequiredPrefix,
                actualDescription
                );

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.ValueIsSecretPrefix,
                actualDescription
                );
        }
示例#4
0
        public void DirectoryPathArgumentNotHiddenButRequiredTest()
        {
            // Act
            string actualDescription = ArgumentBinder.GetDescription <DirectoryPathArgumentNotHiddenButRequiredNotExisting>(taskDescription);

            // Check

            // -------- Lines that should be there --------

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"--{argumentName}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                argDescription,
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.SourcePrefix}: {BaseAttribute.DefaultArgumentSource}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.TypePrefix}: {typeof( DirectoryPath ).Name}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.RequiredPrefix}: {true}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BasePathAttribute.MustExistPrefix}: {false}",
                actualDescription
                );


            // -------- Lines that should NOT there --------

            // Required argument, default value is not needed.
            // Should not print it.
            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.DefaultValuePrefix,
                actualDescription
                );
        }
        public void StringArgumentNullDefaultValueTest()
        {
            // Act
            string actualDescription = ArgumentBinder.GetDescription <StringArgumentNullDefaultValue>(taskDescription);

            // Check

            // -------- Lines that should be there --------

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"--{argumentName}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                argDescription,
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.SourcePrefix}: {BaseAttribute.DefaultArgumentSource}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.TypePrefix}: {typeof( string ).Name}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.DefaultValuePrefix}: [null]",
                actualDescription
                );

            // -------- Lines that should NOT there --------

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.RequiredPrefix,
                actualDescription
                );

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.ValueIsSecretPrefix,
                actualDescription
                );
        }
示例#6
0
        public void EnumArugmentNotHiddenRequiredIgnoreCaseTest()
        {
            // Act
            string actualDescription = ArgumentBinder.GetDescription <EnumArgumentNotHiddenButRequiredIgnoreCase>(taskDescription);

            // Check

            // -------- Lines that should be there --------

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"--{argumentName}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                argDescription,
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.SourcePrefix}: {BaseAttribute.DefaultArgumentSource}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.TypePrefix}: {typeof( TestEnum ).Name}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{EnumArgumentAttribute.CasingIgnorePrefix}: {true}",
                actualDescription
                );

            TestHelpers.EnsureLineExistsFromMultiLineString(
                EnumArgumentAttribute.PossibleValuePrefix,
                actualDescription
                );

            foreach (Enum value in Enum.GetValues(typeof(TestEnum)))
            {
                TestHelpers.EnsureLineExistsFromMultiLineString(
                    $"- {value}",
                    actualDescription
                    );
            }

            TestHelpers.EnsureLineExistsFromMultiLineString(
                $"{BaseAttribute.RequiredPrefix}: {true}",
                actualDescription
                );

            // -------- Lines that should NOT there --------

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.DefaultValuePrefix,
                actualDescription
                );

            TestHelpers.EnsureLineDoesNotExistFromMultiLineString(
                BaseAttribute.ValueIsSecretPrefix,
                actualDescription
                );
        }