Separate ASP.NET Core tests into a distinct project and make the main test project netfx compatible. (#254)
* Separate ASP.NET Core tests into a distinct project and make the main test project netfx compatible. * Fix merge conflicts. * Update tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj Co-authored-by: Stephen Halter <halter73@gmail.com> * Revert "Fix merge conflicts." This reverts commit 852169b96786bad2144795540fa164e20b4b197e. * Fix merge conflicts --------- Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
parent
08f9cdbf7d
commit
39ab6cde0d
2 changed files with 324 additions and 63 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net9.0;net8.0;net472</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>TestServer</AssemblyName>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ internal static class Program
|
|||
|
||||
private static async Task RunBackgroundLoop(IMcpServer server, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var loggingLevels = Enum.GetValues<LoggingLevel>();
|
||||
var loggingLevels = (LoggingLevel[])Enum.GetValues(typeof(LoggingLevel));
|
||||
var random = new Random();
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -74,7 +75,7 @@ internal static class Program
|
|||
// Send random log messages every few seconds
|
||||
if (_minimumLoggingLevel is not null)
|
||||
{
|
||||
var logLevel = loggingLevels[Random.Shared.Next(loggingLevels.Length)];
|
||||
var logLevel = loggingLevels[random.Next(loggingLevels.Length)];
|
||||
await server.SendMessageAsync(new JsonRpcNotification()
|
||||
{
|
||||
Method = NotificationMethods.LoggingMessageNotification,
|
||||
|
|
@ -468,7 +469,7 @@ internal static class Program
|
|||
throw new McpException("Invalid resource URI");
|
||||
}
|
||||
|
||||
_subscribedResources.Remove(request.Params.Uri, out _);
|
||||
_subscribedResources.TryRemove(request.Params.Uri, out _);
|
||||
|
||||
return Task.FromResult(new EmptyResult());
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue