fix: throw exception when accessing result props incorrectly
This commit is contained in:
@@ -11,7 +11,12 @@ public class AnthropicResultTests
|
||||
var actual = AnthropicResult<string>.Success(value, headers);
|
||||
|
||||
actual.IsSuccess.Should().BeTrue();
|
||||
actual.IsFailure.Should().BeFalse();
|
||||
actual.Value.Should().Be(value);
|
||||
|
||||
var action = () => { var _ = actual.Error; };
|
||||
action.Should().Throw<InvalidOperationException>();
|
||||
|
||||
actual.Headers.Should().Be(headers);
|
||||
}
|
||||
|
||||
@@ -24,7 +29,12 @@ public class AnthropicResultTests
|
||||
var actual = AnthropicResult<string>.Failure(error, headers);
|
||||
|
||||
actual.IsSuccess.Should().BeFalse();
|
||||
actual.IsFailure.Should().BeTrue();
|
||||
actual.Error.Should().Be(error);
|
||||
|
||||
var action = () => { var _ = actual.Value; };
|
||||
action.Should().Throw<InvalidOperationException>();
|
||||
|
||||
actual.Headers.Should().Be(headers);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user