📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
1.2 KiB

// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System;
using System.IO;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.PixelFormats;
using Xunit;
namespace SixLabors.ImageSharp.Tests
{
public partial class ImageTests
{
public class Load_FromStream_Throws : IDisposable
{
private static readonly byte[] Data = new byte[] { 0x01 };
private MemoryStream Stream { get; } = new MemoryStream(Data);
[Fact]
public void Image_Load_Throws_UnknownImageFormatException()
=> Assert.Throws<UnknownImageFormatException>(() =>
{
using (Image.Load(DecoderOptions.Default, this.Stream, out IImageFormat format))
{
}
});
[Fact]
public void Image_Load_T_Throws_UnknownImageFormatException()
=> Assert.Throws<UnknownImageFormatException>(() =>
{
using (Image.Load<Rgba32>(DecoderOptions.Default, this.Stream, out IImageFormat format))
{
}
});
public void Dispose() => this.Stream?.Dispose();
}
}
}