- 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>
79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
using Xunit;
|
|
using Svrnty.MCP.Gateway.Core.Models;
|
|
|
|
namespace Svrnty.MCP.Gateway.Core.Tests.Models;
|
|
|
|
/// <summary>
|
|
/// Unit tests for ServerInfo model following TDD approach.
|
|
/// Tests server metadata representation.
|
|
/// </summary>
|
|
public class ServerInfoTests
|
|
{
|
|
[Fact]
|
|
public void ServerInfo_WithValidData_CreatesSuccessfully()
|
|
{
|
|
// Arrange
|
|
var now = DateTime.UtcNow;
|
|
|
|
// Act
|
|
var serverInfo = new ServerInfo
|
|
{
|
|
Id = "test-server",
|
|
Name = "Test Server",
|
|
IsHealthy = true,
|
|
LastHealthCheck = now,
|
|
ResponseTime = TimeSpan.FromMilliseconds(50),
|
|
Metadata = new Dictionary<string, string>
|
|
{
|
|
{ "region", "us-east" },
|
|
{ "version", "1.0.0" }
|
|
}
|
|
};
|
|
|
|
// Assert
|
|
Assert.Equal("test-server", serverInfo.Id);
|
|
Assert.Equal("Test Server", serverInfo.Name);
|
|
Assert.True(serverInfo.IsHealthy);
|
|
Assert.Equal(now, serverInfo.LastHealthCheck);
|
|
Assert.Equal(50, serverInfo.ResponseTime?.TotalMilliseconds);
|
|
Assert.NotNull(serverInfo.Metadata);
|
|
Assert.Equal("us-east", serverInfo.Metadata["region"]);
|
|
}
|
|
|
|
[Fact]
|
|
public void ServerInfo_DefaultState_HasEmptyId()
|
|
{
|
|
// Arrange & Act
|
|
var serverInfo = new ServerInfo();
|
|
|
|
// Assert
|
|
Assert.Equal(string.Empty, serverInfo.Id);
|
|
Assert.Equal(string.Empty, serverInfo.Name);
|
|
Assert.False(serverInfo.IsHealthy);
|
|
Assert.Null(serverInfo.LastHealthCheck);
|
|
Assert.Null(serverInfo.ResponseTime);
|
|
Assert.Null(serverInfo.Metadata);
|
|
}
|
|
|
|
[Fact]
|
|
public void ServerInfo_WithMetadata_StoresCorrectly()
|
|
{
|
|
// Arrange & Act
|
|
var serverInfo = new ServerInfo
|
|
{
|
|
Id = "metadata-test",
|
|
Metadata = new Dictionary<string, string>
|
|
{
|
|
{ "environment", "production" },
|
|
{ "datacenter", "dc1" }
|
|
}
|
|
};
|
|
|
|
// Assert
|
|
Assert.NotNull(serverInfo.Metadata);
|
|
Assert.Equal(2, serverInfo.Metadata.Count);
|
|
Assert.Equal("production", serverInfo.Metadata["environment"]);
|
|
Assert.Equal("dc1", serverInfo.Metadata["datacenter"]);
|
|
}
|
|
}
|