mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
e5f7b9c260
* support reflection for discovery of resources and scripts in class-based skills * fix format issues * refactor samples to use reflection * Validate resource member signatures during discovery Add discovery-time validation in AgentClassSkill.DiscoverResources() to fail fast when [AgentSkillResource] is applied to members with incompatible signatures: - Reject indexer properties (getter has parameters) - Reject methods with parameters other than IServiceProvider or CancellationToken Throws InvalidOperationException with actionable error messages instead of allowing silent runtime failures when ReadAsync invokes the AIFunction with no named arguments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * prevent duplicates --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
30 lines
683 B
C#
30 lines
683 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
namespace Microsoft.Agents.AI.UnitTests.AgentSkills;
|
|
|
|
/// <summary>
|
|
/// Unit tests for <see cref="AgentSkillResourceAttribute"/>.
|
|
/// </summary>
|
|
public sealed class AgentSkillResourceAttributeTests
|
|
{
|
|
[Fact]
|
|
public void DefaultConstructor_NameIsNull()
|
|
{
|
|
// Arrange & Act
|
|
var attr = new AgentSkillResourceAttribute();
|
|
|
|
// Assert
|
|
Assert.Null(attr.Name);
|
|
}
|
|
|
|
[Fact]
|
|
public void NamedConstructor_SetsName()
|
|
{
|
|
// Arrange & Act
|
|
var attr = new AgentSkillResourceAttribute("my-resource");
|
|
|
|
// Assert
|
|
Assert.Equal("my-resource", attr.Name);
|
|
}
|
|
}
|