chore: import upstream snapshot with attribution
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
This commit is contained in:
+75
@@ -0,0 +1,75 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Agents.AI.Foundry.Hosting.UnitTests;
|
||||
|
||||
public class FoundryAIToolExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void CreateHostedMcpToolbox_FromToolboxRecord_UsesNameAndDefaultVersion()
|
||||
{
|
||||
var record = Azure.AI.Projects.Agents.ProjectsAgentsModelFactory.ToolboxRecord(
|
||||
id: "tbx-123",
|
||||
name: "calendar-tools",
|
||||
defaultVersion: "v2");
|
||||
|
||||
var tool = FoundryAIToolExtensions.CreateHostedMcpToolbox(record);
|
||||
|
||||
var marker = Assert.IsType<HostedMcpToolboxAITool>(tool);
|
||||
Assert.Equal("calendar-tools", marker.ToolboxName);
|
||||
Assert.Equal("v2", marker.Version);
|
||||
Assert.Equal("foundry-toolbox://calendar-tools?version=v2", marker.ServerAddress);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateHostedMcpToolbox_FromToolboxRecord_NullDefaultVersionOmitsQuery()
|
||||
{
|
||||
var record = Azure.AI.Projects.Agents.ProjectsAgentsModelFactory.ToolboxRecord(
|
||||
id: "tbx-abc",
|
||||
name: "finance-tools",
|
||||
defaultVersion: null);
|
||||
|
||||
var tool = FoundryAIToolExtensions.CreateHostedMcpToolbox(record);
|
||||
|
||||
var marker = Assert.IsType<HostedMcpToolboxAITool>(tool);
|
||||
Assert.Equal("finance-tools", marker.ToolboxName);
|
||||
Assert.Null(marker.Version);
|
||||
Assert.Equal("foundry-toolbox://finance-tools", marker.ServerAddress);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateHostedMcpToolbox_FromToolboxRecord_Null_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(
|
||||
() => FoundryAIToolExtensions.CreateHostedMcpToolbox((Azure.AI.Projects.Agents.ToolboxRecord)null!));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateHostedMcpToolbox_FromToolboxVersion_UsesNameAndVersion()
|
||||
{
|
||||
var version = Azure.AI.Projects.Agents.ProjectsAgentsModelFactory.ToolboxVersion(
|
||||
metadata: null,
|
||||
id: "ver-1",
|
||||
name: "hr-tools",
|
||||
version: "2025-09-01",
|
||||
description: "HR toolbox",
|
||||
createdAt: DateTimeOffset.UtcNow,
|
||||
tools: null,
|
||||
policies: null);
|
||||
|
||||
var tool = FoundryAIToolExtensions.CreateHostedMcpToolbox(version);
|
||||
|
||||
var marker = Assert.IsType<HostedMcpToolboxAITool>(tool);
|
||||
Assert.Equal("hr-tools", marker.ToolboxName);
|
||||
Assert.Equal("2025-09-01", marker.Version);
|
||||
Assert.Equal("foundry-toolbox://hr-tools?version=2025-09-01", marker.ServerAddress);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateHostedMcpToolbox_FromToolboxVersion_Null_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(
|
||||
() => FoundryAIToolExtensions.CreateHostedMcpToolbox((Azure.AI.Projects.Agents.ToolboxVersion)null!));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user