|
|
|
@ -34,8 +34,9 @@ public partial class ImageTests |
|
|
|
[Fact] |
|
|
|
public void FromBytes_GlobalConfiguration() |
|
|
|
{ |
|
|
|
IImageFormat type = Image.DetectFormat(this.ActualImageSpan); |
|
|
|
bool result = Image.TryDetectFormat(this.ActualImageSpan, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.True(result); |
|
|
|
Assert.Equal(ExpectedGlobalFormat, type); |
|
|
|
} |
|
|
|
|
|
|
|
@ -47,15 +48,18 @@ public partial class ImageTests |
|
|
|
Configuration = this.LocalConfiguration |
|
|
|
}; |
|
|
|
|
|
|
|
IImageFormat type = Image.DetectFormat(options, this.ByteArray); |
|
|
|
bool result = Image.TryDetectFormat(options, this.ByteArray, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.True(result); |
|
|
|
Assert.Equal(this.LocalImageFormat, type); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void FromFileSystemPath_GlobalConfiguration() |
|
|
|
{ |
|
|
|
IImageFormat type = Image.DetectFormat(ActualImagePath); |
|
|
|
bool result = Image.TryDetectFormat(ActualImagePath, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.True(result); |
|
|
|
Assert.Equal(ExpectedGlobalFormat, type); |
|
|
|
} |
|
|
|
|
|
|
|
@ -67,7 +71,9 @@ public partial class ImageTests |
|
|
|
Configuration = this.LocalConfiguration |
|
|
|
}; |
|
|
|
|
|
|
|
IImageFormat type = Image.DetectFormat(options, this.MockFilePath); |
|
|
|
bool result = Image.TryDetectFormat(options, this.MockFilePath, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.True(result); |
|
|
|
Assert.Equal(this.LocalImageFormat, type); |
|
|
|
} |
|
|
|
|
|
|
|
@ -76,7 +82,9 @@ public partial class ImageTests |
|
|
|
{ |
|
|
|
using (var stream = new MemoryStream(this.ActualImageBytes)) |
|
|
|
{ |
|
|
|
IImageFormat type = Image.DetectFormat(stream); |
|
|
|
bool result = Image.TryDetectFormat(stream, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.True(result); |
|
|
|
Assert.Equal(ExpectedGlobalFormat, type); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -89,7 +97,9 @@ public partial class ImageTests |
|
|
|
Configuration = this.LocalConfiguration |
|
|
|
}; |
|
|
|
|
|
|
|
IImageFormat type = Image.DetectFormat(options, this.DataStream); |
|
|
|
bool result = Image.TryDetectFormat(options, this.DataStream, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.True(result); |
|
|
|
Assert.Equal(this.LocalImageFormat, type); |
|
|
|
} |
|
|
|
|
|
|
|
@ -101,7 +111,9 @@ public partial class ImageTests |
|
|
|
Configuration = new() |
|
|
|
}; |
|
|
|
|
|
|
|
IImageFormat type = Image.DetectFormat(options, this.DataStream); |
|
|
|
bool result = Image.TryDetectFormat(options, this.DataStream, out IImageFormat type); |
|
|
|
|
|
|
|
Assert.False(result); |
|
|
|
Assert.Null(type); |
|
|
|
} |
|
|
|
|
|
|
|
|