Пример #1
0
    public void Aliases()
    {
        var path = AllFiles.GetPathFor("jpeg");

        Assert.True(AllFiles.IsEmptyFile(path));

        Assert.Contains("jpeg", AllFiles.ImageExtensions);
    }
Пример #2
0
 public void GetPathFor()
 {
     #region GetPathFor
     var path = AllFiles.GetPathFor("jpg");
     #endregion
     var path2 = AllFiles.GetPathFor(".jpg");
     Assert.NotNull(path);
     Assert.NotNull(path2);
     Assert.True(File.Exists(path));
     Assert.True(File.Exists(path2));
 }
Пример #3
0
 public void Unknown_extension()
 {
     Assert.Throws <Exception>(() => AllFiles.GetPathFor("txt"));
     Assert.False(AllFiles.TryGetPathFor("txt", out var result));
     Assert.Null(result);
     Assert.False(AllFiles.TryGetPathFor(".txt", out result));
     Assert.Null(result);
     Assert.False(AllFiles.TryCreateFile("foo.txt"));
     Assert.Null(result);
     Assert.Throws <Exception>(() => AllFiles.GetPathFor(".txt"));
     Assert.Throws <Exception>(() => AllFiles.CreateFile("foo.txt"));
 }
Пример #4
0
    public void IsEmptyFile()
    {
        #region IsEmptyFile
        var path = AllFiles.GetPathFor("jpg");
        Assert.True(AllFiles.IsEmptyFile(path));
        var temp = Path.GetTempFileName();
        Assert.False(AllFiles.IsEmptyFile(temp));
        #endregion

        var path2 = AllFiles.GetPathFor(".jpg");
        Assert.True(AllFiles.IsEmptyFile(path2));
        File.Delete(temp);
    }