Example #1
0
    public async Task ImplementationTest()
    {
        IThumbnailsRenderer testRenderer = new TestRenderer();

        Assert.IsTrue(
            testRenderer.IsSupported(
                new ThumbnailsRenderFileInfo(
                    new FileHandle("test_file"),
                    new FileStats(DateTimeOffset.Now, DateTimeOffset.Now, 100, FileType.File, new FileHash("unavailable")),
                    MimeType.text_plain)));
        Assert.IsTrue(
            testRenderer.IsSupported(
                new ThumbnailsRenderFileInfo(
                    new FileHandle("test_file"),
                    new FileStats(DateTimeOffset.Now, DateTimeOffset.Now, 100, FileType.File, new FileHash("unavailable")),
                    MimeType.image_png)));
        Assert.IsFalse(
            testRenderer.IsSupported(
                new ThumbnailsRenderFileInfo(
                    new FileHandle("test_file"),
                    new FileStats(DateTimeOffset.Now, DateTimeOffset.Now, 1001, FileType.File, new FileHash("unavailable")),
                    MimeType.image_png)));
        Assert.IsFalse(
            testRenderer.IsSupported(
                new ThumbnailsRenderFileInfo(
                    new FileHandle("test_file"),
                    new FileStats(DateTimeOffset.Now, DateTimeOffset.Now, 100, FileType.File, new FileHash("unavailable")),
                    MimeType.image_jpeg)));

        using var testRenderContext = new ThumbnailsRenderContext();

        Assert.IsTrue(
            await testRenderer.Render(
                testRenderContext,
                new ThumbnailsRenderFileInfo(
                    new FileHandle("test_file"),
                    new FileStats(DateTimeOffset.Now, DateTimeOffset.Now, 100, FileType.File, new FileHash("unavailable")),
                    MimeType.image_png),
                new ThumbnailsRenderOption()));
        Assert.IsFalse(
            await testRenderer.Render(
                testRenderContext,
                new ThumbnailsRenderFileInfo(
                    new FileHandle("test_file"),
                    new FileStats(DateTimeOffset.Now, DateTimeOffset.Now, 100, FileType.File, new FileHash("unavailable")),
                    MimeType.image_jpeg),
                new ThumbnailsRenderOption()));
    }