27 lines
744 B
C#
27 lines
744 B
C#
|
|
// Copyright (c) The Geekeey Authors
|
||
|
|
// SPDX-License-Identifier: EUPL-1.2
|
||
|
|
|
||
|
|
namespace Geekeey.Request.Result.Tests;
|
||
|
|
|
||
|
|
internal sealed class ErrorTests
|
||
|
|
{
|
||
|
|
[Test]
|
||
|
|
public async Task I_can_implicitly_convert_from_string_and_get_string_error()
|
||
|
|
{
|
||
|
|
Error error = "error";
|
||
|
|
|
||
|
|
using var scope = Assert.Multiple();
|
||
|
|
await Assert.That(error).IsTypeOf<StringError>();
|
||
|
|
await Assert.That(error.Message).IsEqualTo("error");
|
||
|
|
}
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public async Task I_can_implicitly_convert_from_exception_and_get_exception_error()
|
||
|
|
{
|
||
|
|
Error error = new CustomTestException();
|
||
|
|
|
||
|
|
using var scope = Assert.Multiple();
|
||
|
|
var instance = await Assert.That(error).IsTypeOf<ExceptionError>();
|
||
|
|
await Assert.That(instance?.Exception).IsTypeOf<CustomTestException>();
|
||
|
|
}
|
||
|
|
}
|