Files
microsoft--agent-framework/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Entities/EntityExtractionResultTest.cs
T
wehub-resource-sync db620d33df
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
chore: import upstream snapshot with attribution
2026-07-13 13:39:25 +08:00

71 lines
1.7 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.Workflows.Declarative.Entities;
using Microsoft.PowerFx.Types;
namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.Entities;
/// <summary>
/// Tests for <see cref="EntityExtractionResult"/>.
/// </summary>
public sealed class EntityExtractionResultTest(ITestOutputHelper output) : WorkflowTest(output)
{
[Fact]
public void ConstructorWithErrorMessage()
{
// Arrange
const string ErrorMessage = "Test error message";
// Act
EntityExtractionResult result = new(ErrorMessage);
// Assert
Assert.Null(result.Value);
Assert.Equal(ErrorMessage, result.ErrorMessage);
Assert.False(result.IsValid);
}
[Fact]
public void ConstructorWithNullValue()
{
// Arrange
FormulaValue? value = null;
// Act
EntityExtractionResult result = new(value);
// Assert
Assert.Null(result.Value);
Assert.Null(result.ErrorMessage);
Assert.False(result.IsValid);
}
[Fact]
public void ConstructorWithNumberValue()
{
// Arrange
FormulaValue value = FormulaValue.New(double.MaxValue);
// Act
EntityExtractionResult result = new(value);
// Assert
NumberValue numberValue = Assert.IsType<NumberValue>(result.Value);
Assert.Equal(double.MaxValue, numberValue.Value);
}
[Fact]
public void ConstructorWithBlankValue_IsValid()
{
// Arrange
FormulaValue value = FormulaValue.NewBlank();
// Act
EntityExtractionResult result = new(value);
// Assert
Assert.Equal(value, result.Value);
Assert.True(result.IsValid);
}
}