コード例 #1
0
    public void SwitchSetHashFunction_single_sets_single_hash_output(SwitchSetHashFunction sut, string hashName)
    {
        var    fixture  = new SevenZipSettingsFixture();
        string expected = "-scrc" + hashName;

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

        actual.ShouldBe(expected);
    }
コード例 #2
0
    /// <summary>
    /// fluent setter for <see cref="ISupportSwitchSetHashFunction"/>.
    /// </summary>
    /// <typeparam name="T">the builder to support the <see cref="ISupportSwitchSetHashFunction"/>.</typeparam>
    /// <param name="this">The builder-instance.</param>
    /// <param name="hashFunction">The hash-function.</param>
    /// <param name="additionalHashFunctions">Any additional hash-functions.</param>
    /// <returns>The builder-instance for fluent re-use.</returns>
    public static T WithHashFunction <T>(this T @this, SwitchSetHashFunction hashFunction, params SwitchSetHashFunction[] additionalHashFunctions)
        where T : ISupportSwitchBuilder <ISupportSwitchSetHashFunction>
    {
        if (@this.Command.HashFunctions == null)
        {
            @this.Command.HashFunctions = new SwitchSetHashFunctionCollection(hashFunction);
        }
        else
        {
            @this.Command.HashFunctions.Add(hashFunction);
        }

        foreach (var f in additionalHashFunctions)
        {
            @this.Command.HashFunctions.Add(f);
        }

        return(@this);
    }