result/src/Result.Tests/ErrorTests.cs
Louis Seubert a9a923120f
All checks were successful
default / default (8.0) (push) Successful in 35s
rename tests
2024-04-29 22:59:44 +02:00

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>());
});
}
}