예제 #1
0
    public void Enumeration_none_matching_filePattern_Returns_EmptyResult()
    {
        var fileSpec = new FileSpecification(
            this._tempPath,
            true,
            new[] { "*.xyz" },
            Enumerable.Empty <string>());
        List <IDataSource> files = fileSpec.EnumerateFiles().ToList();

        files.Count.Should().Be(0);
    }
예제 #2
0
    public void Enumeration_excluding_patterns_Returns_CorrectResult()
    {
        var fileSpec = new FileSpecification(
            this._tempPath,
            true,
            Enumerable.Empty <string>(),
            new[] { "*.asp", "*.bmp", "*.txt" });
        List <IDataSource> files = fileSpec.EnumerateFiles().ToList();

        files.Count.Should().Be(1);
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempPath, "temp1.css"));
    }
예제 #3
0
    public void Enumeration_TopLevel_Only()
    {
        var fileSpec = new FileSpecification(
            this._tempPath,
            false,
            Enumerable.Empty <string>(),
            Enumerable.Empty <string>());

        List <IDataSource> files = fileSpec.EnumerateFiles().ToList();

        files.Count.Should().Be(2);
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempPath, "temp1.css"));
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempPath, "temp2.txt"));
    }
예제 #4
0
    public void Enumeration_IncludeSubdirectories()
    {
        var fileSpec = new FileSpecification(
            this._tempPath,
            true,
            Enumerable.Empty <string>(),
            Enumerable.Empty <string>());
        List <IDataSource> files = fileSpec.EnumerateFiles().ToList();

        files.Count.Should().Be(4);
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempPath, "temp1.css"));
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempPath, "temp2.txt"));
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempSubfolder, "temp3.asp"));
        files.Should().Contain(x => x.Identifier == Path.Combine(this._tempSubfolder, "temp4.bmp"));
    }