svrnty-mcp-client/tests/Svrnty.MCP.Client.Core.Tests/Exceptions/McpConnectionExceptionTests.cs
Svrnty 97880406dc refactor: rename OpenHarbor.MCP to Svrnty.MCP across all libraries
- Renamed all directories: OpenHarbor.MCP.* → Svrnty.MCP.*
- Updated all namespaces in 179 C# files
- Renamed 20 .csproj files and 3 .sln files
- Updated 193 documentation references
- Updated 33 references in main CODEX codebase
- Updated Codex.sln with new paths
- Build verified: 0 errors

Preparing for extraction to standalone repositories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 21:04:17 -04:00

63 lines
1.9 KiB
C#

using Svrnty.MCP.Client.Core.Exceptions;
using Xunit;
namespace Svrnty.MCP.Client.Core.Tests.Exceptions;
/// <summary>
/// Unit tests for MCP exception types.
/// Tests exception creation, messages, and properties.
/// </summary>
public class McpConnectionExceptionTests
{
[Fact]
public void McpConnectionException_WithMessage_CreatesException()
{
// Arrange & Act
var exception = new McpConnectionException("Test error");
// Assert
Assert.Equal("Test error", exception.Message);
Assert.Null(exception.InnerException);
}
[Fact]
public void McpConnectionException_WithInnerException_CreatesException()
{
// Arrange
var innerException = new InvalidOperationException("Inner error");
// Act
var exception = new McpConnectionException("Test error", innerException);
// Assert
Assert.Equal("Test error", exception.Message);
Assert.Same(innerException, exception.InnerException);
}
[Fact]
public void ServerNotFoundException_WithServerName_SetsProperties()
{
// Arrange & Act
var exception = new ServerNotFoundException("test-server");
// Assert
Assert.Equal("test-server", exception.ServerName);
Assert.Contains("test-server", exception.Message);
Assert.Contains("not found or not connected", exception.Message);
}
[Fact]
public void ToolNotFoundException_WithServerAndToolName_SetsProperties()
{
// Arrange & Act
var exception = new ToolNotFoundException("test-server", "test_tool");
// Assert
Assert.Equal("test-server", exception.ServerName);
Assert.Equal("test_tool", exception.ToolName);
Assert.Contains("test_tool", exception.Message);
Assert.Contains("test-server", exception.Message);
Assert.Contains("not found on server", exception.Message);
}
}