svrnty-mcp-gateway/tests/Svrnty.MCP.Gateway.Core.Tests/Models/ServerHealthStatusTests.cs
Svrnty 19ef79362e 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

67 lines
1.8 KiB
C#

using Xunit;
using Svrnty.MCP.Gateway.Core.Models;
namespace Svrnty.MCP.Gateway.Core.Tests.Models;
/// <summary>
/// Unit tests for ServerHealthStatus model following TDD approach.
/// Tests server health representation.
/// </summary>
public class ServerHealthStatusTests
{
[Fact]
public void ServerHealthStatus_Healthy_CreatesSuccessfully()
{
// Arrange
var now = DateTime.UtcNow;
// Act
var status = new ServerHealthStatus
{
ServerId = "server-1",
ServerName = "Test Server",
IsHealthy = true,
LastCheck = now,
ResponseTime = TimeSpan.FromMilliseconds(25)
};
// Assert
Assert.Equal("server-1", status.ServerId);
Assert.Equal("Test Server", status.ServerName);
Assert.True(status.IsHealthy);
Assert.Equal(now, status.LastCheck);
Assert.Equal(25, status.ResponseTime?.TotalMilliseconds);
Assert.Null(status.ErrorMessage);
}
[Fact]
public void ServerHealthStatus_Unhealthy_IncludesErrorMessage()
{
// Arrange & Act
var status = new ServerHealthStatus
{
ServerId = "server-2",
IsHealthy = false,
LastCheck = DateTime.UtcNow,
ErrorMessage = "Connection timeout"
};
// Assert
Assert.False(status.IsHealthy);
Assert.Equal("Connection timeout", status.ErrorMessage);
Assert.Null(status.ResponseTime);
}
[Fact]
public void ServerHealthStatus_DefaultState_IsNotHealthy()
{
// Arrange & Act
var status = new ServerHealthStatus();
// Assert
Assert.False(status.IsHealthy);
Assert.Null(status.ErrorMessage);
Assert.Null(status.ResponseTime);
}
}