- 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>
65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using Xunit;
|
|
using Svrnty.MCP.Gateway.Infrastructure.Transport;
|
|
using Svrnty.MCP.Gateway.Core.Models;
|
|
|
|
namespace Svrnty.MCP.Gateway.Infrastructure.Tests.Transport;
|
|
|
|
/// <summary>
|
|
/// Unit tests for StdioServerTransport following TDD approach.
|
|
/// Tests stdio transport implementation.
|
|
/// </summary>
|
|
public class StdioServerTransportTests
|
|
{
|
|
[Fact]
|
|
public void Constructor_WithValidCommand_CreatesSuccessfully()
|
|
{
|
|
// Arrange & Act
|
|
var transport = new StdioServerTransport("dotnet", new[] { "run" });
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
Assert.False(transport.IsConnected);
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_WithNullCommand_ThrowsException()
|
|
{
|
|
// Arrange, Act & Assert
|
|
Assert.Throws<ArgumentNullException>(() =>
|
|
new StdioServerTransport(null!, new[] { "arg" }));
|
|
}
|
|
|
|
[Fact]
|
|
public void IsConnected_BeforeConnect_ReturnsFalse()
|
|
{
|
|
// Arrange
|
|
var transport = new StdioServerTransport("echo", new[] { "test" });
|
|
|
|
// Act & Assert
|
|
Assert.False(transport.IsConnected);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task SendRequestAsync_WithoutConnect_ThrowsException()
|
|
{
|
|
// Arrange
|
|
var transport = new StdioServerTransport("echo", new[] { "test" });
|
|
var request = new GatewayRequest { ToolName = "test" };
|
|
|
|
// Act & Assert
|
|
await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
|
transport.SendRequestAsync(request, CancellationToken.None));
|
|
}
|
|
|
|
[Fact]
|
|
public void Dispose_MultipleTimesests_DoesNotThrow()
|
|
{
|
|
// Arrange
|
|
var transport = new StdioServerTransport("echo", new[] { "test" });
|
|
|
|
// Act & Assert
|
|
transport.Dispose();
|
|
transport.Dispose(); // Should not throw
|
|
}
|
|
}
|