예제 #1
0
    public void TestCommand_without_archive_should_throw()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InTestMode();

        Action action = () => fixture.EvaluateArgs();

        action.ShouldThrow <ArgumentException>();
    }
예제 #2
0
    public void Hash_without_file_or_archive_thows()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InHashMode();

        Action action = () => fixture.EvaluateArgs();

        action.ShouldThrow <ArgumentException>();
    }
예제 #3
0
    public void Information_can_be_used()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InInformationMode();

        const string expected = @"i";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
    public void Benchmark_can_be_used_alone()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InBenchmarkMode();

        const string expected = @"b";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
    public void Benchmark_can_use_dictionarySize()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InBenchmarkMode()
        .WithDictionarySize(26);

        const string expected = @"b -md26";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
    public void Benchmark_can_use_numberOfThreads()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InBenchmarkMode()
        .WithNumberOfThreads(10);

        const string expected = @"b -mmt10";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #7
0
    public void TestCommand_with_archive_should_work()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InTestMode()
        .WithArchive(new FilePath("in.zip"));

        const string expected = @"t ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #8
0
    public void Hash_with_directoryContents_works()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InHashMode()
        .WithDirectoryContents(new DirectoryPath("/foo"));

        const string expected = @"h ""/foo""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
    public void Benchmark_can_use_method()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InBenchmarkMode()
        .WithMethod("*");

        const string expected = @"b -mm=*";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #10
0
    public void Delete_can_use_archive_without_files_or_directories()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"));

        const string expected = @"d ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #11
0
    public void Extract_can_use_Archive()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InExtractMode()
        .WithArchive(new FilePath("in.zip"));

        const string expected = @"x -y ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #12
0
    public void Hash_with_files_works()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InHashMode()
        .WithFiles(new FilePath("in.txt"));

        const string expected = @"h ""in.txt""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #13
0
    public void Delete_throws_on_missing_archive()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode();

        Action result = () =>
        {
            fixture.EvaluateArgs();
        };

        result.ShouldThrow <ArgumentException>();
    }
예제 #14
0
    public void Delete_can_use_FullQualifiedPaths_without_driveletter()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"))
        .WithFullyQualifiedFilePaths(false);

        const string expected = @"d -spf2 ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #15
0
    public void Delete_can_use_Sfx_with_module()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"))
        .WithSelfExtractingArchive(new FilePath("7zS2.sfx "));

        const string expected = @"d -sfx""7zS2.sfx"" ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #16
0
    public void Delete_can_use_ExcludeFiles_with_recusion()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"))
        .WithExcludeFilenames(RecurseType.Disable, "*.pdf");

        const string expected = @"d -xr-!*.pdf ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #17
0
    public void Delete_can_use_IncludeFiles()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"))
        .WithIncludeFilenames("*.pdf");

        const string expected = @"d -i!*.pdf ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #18
0
    public void Hash_with_compressionMethod_works()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InHashMode()
        .WithFiles(new FilePath("in.txt"))
        .WithCompressionMethod(m => m.Level = 9);

        const string expected = @"h -mx=9 ""in.txt""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #19
0
    public void TestCommand_can_use_WithRecurseSubdirectories()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InTestMode()
        .WithArchive(new FilePath("in.zip"))
        .WithRecurseSubdirectories(RecurseType.Enable);

        const string expected = @"t -r ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #20
0
    public void TestCommand_can_use_WithDisableParsingOfArchiveName()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InTestMode()
        .WithArchive(new FilePath("in.zip"))
        .WithDisableParsingOfArchiveName();

        const string expected = @"t -an ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #21
0
    public void Extract_can_use_IncludeArchiveFiles_with_recusion()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InExtractMode()
        .WithArchive(new FilePath("in.zip"))
        .WithIncludeArchiveFilenames(RecurseType.Enable, "*.pdf");

        const string expected = @"x -air!*.pdf -y ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #22
0
    public void Rename_throws_on_missing_fileOrDirectory()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InRenameMode()
        .WithArchive(new FilePath("old.zip"));

        Action result = () =>
        {
            fixture.EvaluateArgs();
        };

        result.ShouldThrow <ArgumentException>();
    }
예제 #23
0
    public void Rename_throws_on_missing_archive()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InRenameMode()
        .WithRenameFile(new FilePath("a.txt"), new FilePath("b.txt"));

        Action result = () =>
        {
            fixture.EvaluateArgs();
        };

        result.ShouldThrow <ArgumentException>();
    }
예제 #24
0
    public void Rename_can_use_Archive_and_filePairs()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InRenameMode()
        .WithArchive(new FilePath("old.zip"))
        .WithRenameFile(new FilePath("a.txt"), new FilePath("b.txt"));

        const string expected = @"rn ""old.zip"" ""a.txt"" ""b.txt""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #25
0
    public void TestCommand_can_use_WithNtfsAlternateStreams()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InTestMode()
        .WithArchive(new FilePath("in.zip"))
        .WithNtfsAlternateStreams();

        const string expected = @"t -sns ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #26
0
    public void Delete_can_use_Password()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"))
        .WithPassword("secure!");

        const string expected = @"d -p""secure!"" ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #27
0
    public void Delete_can_use_WorkingDirectory()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InDeleteMode()
        .WithArchive(new FilePath("in.zip"))
        .WithWorkingDirectory(new DirectoryPath("c:\\temp"));

        const string expected = @"d -w""c:/temp"" ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #28
0
    public void Hash_with_recurseSubdirectories_works()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InHashMode()
        .WithFiles(new FilePath("in.txt"))
        .WithRecurseSubdirectories(RecurseType.Enable);

        const string expected = @"h -r ""in.txt""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #29
0
    public void TestCommand_can_use_WithExcludeArchiveFilenames()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InTestMode()
        .WithArchive(new FilePath("in.zip"))
        .WithExcludeArchiveFilenames("*.docx");

        const string expected = @"t -ax!*.docx ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }
예제 #30
0
    public void Extract_can_use_single_output_directory()
    {
        var fixture = new FluentBuilderFixture();

        fixture.Context
        .InExtractMode()
        .WithArchive(new FilePath("in.zip"))
        .WithoutFullPathExtraction();

        const string expected = @"e -y ""in.zip""";

        var actual = fixture.EvaluateArgs();

        actual.ShouldBe(expected);
    }