All checks were successful
default / default (8.0) (push) Successful in 35s
30 lines
No EOL
692 B
C#
30 lines
No EOL
692 B
C#
namespace Geekeey.Extensions.Result.Tests;
|
|
|
|
[TestFixture]
|
|
internal sealed class ErrorTests
|
|
{
|
|
[Test]
|
|
public void I_can_implicitly_convert_from_string_and_get_string_error()
|
|
{
|
|
Error error = "error";
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(error, Is.InstanceOf<StringError>());
|
|
Assert.That(error.Message, Is.EqualTo("error"));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void I_can_implicitly_convert_from_exception_and_get_exception_error()
|
|
{
|
|
Error error = new CustomTestException();
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(error, Is.InstanceOf<ExceptionError>());
|
|
var instance = error as ExceptionError;
|
|
Assert.That(instance?.Exception, Is.InstanceOf<CustomTestException>());
|
|
});
|
|
}
|
|
} |