Implementation for SEP-2243 Http Standardization (#1553)
Co-authored-by: Tarek Mahmoud Sayed <tarekms@microsoft.com> Co-authored-by: Tarek Mahmoud Sayed <tarekms@ntdev.microsoft.com> Co-authored-by: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
3118fcd6cb
commit
b8c4d951ec
1 changed files with 2854 additions and 28 deletions
|
|
@ -0,0 +1,59 @@
|
|||
using ModelContextProtocol.Server;
|
||||
|
||||
namespace ModelContextProtocol.Tests.Server;
|
||||
|
||||
public class McpHeaderAttributeTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Region")]
|
||||
[InlineData("TenantId")]
|
||||
[InlineData("Priority")]
|
||||
[InlineData("X-Custom")]
|
||||
public void Constructor_ValidHeaderName_Succeeds(string name)
|
||||
{
|
||||
var attr = new McpHeaderAttribute(name);
|
||||
Assert.Equal(name, attr.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_NameWithSpace_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new McpHeaderAttribute("My Region"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_NameWithColon_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new McpHeaderAttribute("Region:Primary"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_NullName_Throws()
|
||||
{
|
||||
Assert.ThrowsAny<ArgumentException>(() => new McpHeaderAttribute(null!));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_EmptyName_Throws()
|
||||
{
|
||||
Assert.ThrowsAny<ArgumentException>(() => new McpHeaderAttribute(""));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhitespaceName_Throws()
|
||||
{
|
||||
Assert.ThrowsAny<ArgumentException>(() => new McpHeaderAttribute(" "));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_NameWithControlCharacter_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new McpHeaderAttribute("Region\t1"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_NameWithNonAscii_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new McpHeaderAttribute("Région"));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue