//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Tests
{
using System;
using Xunit;
///
/// Tests the class.
///
public class ImageTests
{
[Fact]
public void ConstructorByteArray()
{
Assert.Throws(() =>
{
new Image((byte[])null);
});
TestFile file = TestFile.Create(TestImages.Bmp.Car);
using (Image image = new Image(file.Bytes))
{
Assert.Equal(600, image.Width);
Assert.Equal(450, image.Height);
}
}
[Fact]
public void ConstructorFileSystem()
{
TestFile file = TestFile.Create(TestImages.Bmp.Car);
using (Image image = new Image(file.FilePath))
{
Assert.Equal(600, image.Width);
Assert.Equal(450, image.Height);
}
}
[Fact]
public void ConstructorFileSystem_FileNotFound()
{
System.IO.FileNotFoundException ex = Assert.Throws(
() =>
{
new Image(Guid.NewGuid().ToString());
});
}
[Fact]
public void ConstructorFileSystem_NullPath()
{
ArgumentNullException ex = Assert.Throws(
() =>
{
new Image(null);
});
}
}
}