fix: throw exception when accessing result props incorrectly

This commit is contained in:
Stevan Freeborn
2024-07-06 11:55:47 -05:00
parent 1d352a6f95
commit c538a3eb8c
8 changed files with 116 additions and 26 deletions
@@ -69,7 +69,6 @@ public class AnthropicApiClientTests : IntegrationTest
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<MessageResponse>();
result.Error.Should().BeNull();
var message = result.Value;
message.Id.Should().Be("msg_013Zva2CMHLNnXjNJJKqJ2EF");
@@ -135,7 +134,6 @@ public class AnthropicApiClientTests : IntegrationTest
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<MessageResponse>();
result.Error.Should().BeNull();
var message = result.Value;
message.Id.Should().Be("msg_01D7FLrfh4GYq7yT1ULFeyMV");
@@ -163,7 +161,6 @@ public class AnthropicApiClientTests : IntegrationTest
var toolCallResult = await message.ToolCall!.InvokeAsync();
toolCallResult.IsSuccess.Should().BeTrue();
toolCallResult.Value!.ToString().Should().Be("^GSPC");
toolCallResult.Error.Should().BeNull();
}
@@ -208,7 +205,6 @@ public class AnthropicApiClientTests : IntegrationTest
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<MessageResponse>();
result.Error.Should().BeNull();
var message = result.Value;
message.Id.Should().Be("msg_01D7FLrfh4GYq7yT1ULFeyMV");
@@ -323,7 +319,6 @@ public class AnthropicApiClientTests : IntegrationTest
var toolCallResult = await toolCall!.InvokeAsync<string>();
toolCallResult.IsSuccess.Should().BeTrue();
toolCallResult.Error.Should().BeNull();
toolCallResult.Value.Should().Be(getWeather("San Francisco, CA","fahrenheit"));
}
}