/// <summary>
    /// fluent setter for <see cref="ISupportSwitchExcludeArchiveFilenames"/>.
    /// </summary>
    /// <typeparam name="T">the builder to support the <see cref="ISupportSwitchExcludeArchiveFilenames"/>.</typeparam>
    /// <param name="this">The builder-instance.</param>
    /// <param name="type">The <see cref="RecurseType"/>.</param>
    /// <param name="fileNameWildcard">The filename-wildcard.</param>
    /// <param name="additional">Additional filename-wildcards.</param>
    /// <returns>The builder-instance for fluent re-use.</returns>
    public static T WithExcludeArchiveFilenames <T>(this T @this, RecurseType type, string fileNameWildcard, params string[] additional)
        where T : ISupportSwitchBuilder <ISupportSwitchExcludeArchiveFilenames>
    {
        var first = new SwitchExcludeArchiveFilename(fileNameWildcard, type);
        var rest  = additional.Select(x => new SwitchExcludeArchiveFilename(x, type));

        return(@this.WithExcludeArchiveFilenames(first, rest));
    }
    public void Exclude_with_Recurse_Wildcards_outputs_r_zero()
    {
        var          fixture  = new SevenZipSettingsFixture();
        var          sut      = new SwitchExcludeArchiveFilename("*.txt", RecurseType.EnableOnlyForWildcardNames);
        const string expected = "-axr0!*.txt";

        var actual = fixture.Parse(b => sut.BuildArguments(ref b));

        actual.ShouldBe(expected);
    }
    public void Exclude_without_Recurse_outputs_no_recurse()
    {
        var          fixture  = new SevenZipSettingsFixture();
        var          sut      = new SwitchExcludeArchiveFilename("*.txt");
        const string expected = "-ax!*.txt";

        var actual = fixture.Parse(b => sut.BuildArguments(ref b));

        actual.ShouldBe(expected);
    }
    public void Exclude_with_Recurse_disabled_outputs_r_minus()
    {
        var          fixture  = new SevenZipSettingsFixture();
        var          sut      = new SwitchExcludeArchiveFilename("*.txt", RecurseType.Disable);
        const string expected = "-axr-!*.txt";

        var actual = fixture.Parse(b => sut.BuildArguments(ref b));

        actual.ShouldBe(expected);
    }
    private static T WithExcludeArchiveFilenames <T>(
        this T @this,
        SwitchExcludeArchiveFilename first,
        IEnumerable <SwitchExcludeArchiveFilename> rest)
        where T : ISupportSwitchBuilder <ISupportSwitchExcludeArchiveFilenames>
    {
        if (@this.Command.ExcludeArchiveFilenames == null)
        {
            @this.Command.ExcludeArchiveFilenames = new SwitchExcludeArchiveFilenameCollection(first);
        }
        else
        {
            @this.Command.ExcludeArchiveFilenames.Add(first);
        }

        rest.ToList().ForEach(@this.Command.ExcludeArchiveFilenames.Add);

        return(@this);
    }