MarketAlly.AIPlugin.Extensions/MarketAlly.AIPlugin.Tests/AgenticEngineBuilderTests.cs

96 lines
2.3 KiB
C#
Executable File

using Agentic.Engine;
namespace MarketAlly.AIPlugin.Tests;
/// <summary>
/// Tests for AgenticEngineBuilder
/// </summary>
public class AgenticEngineBuilderTests
{
[Fact]
public void Build_WithoutConfiguration_ShouldCreateValidEngine()
{
// Arrange
var builder = new AgenticEngineBuilder();
// Act
var engine = builder.Build();
// Assert
engine.Should().NotBeNull();
engine.IsRunning.Should().BeFalse();
}
[Fact]
public void Build_MultipleTimes_ShouldCreateIndependentInstances()
{
// Arrange
var builder = new AgenticEngineBuilder();
// Act
var engine1 = builder.Build();
var engine2 = builder.Build();
// Assert
engine1.Should().NotBeNull();
engine2.Should().NotBeNull();
engine1.Should().NotBeSameAs(engine2);
}
[Fact]
public void WithWorkspacePath_ShouldAcceptValidPath()
{
// Arrange
var builder = new AgenticEngineBuilder();
var testPath = Path.GetTempPath();
// Act
var result = builder.WithWorkspacePath(testPath);
// Assert
result.Should().BeSameAs(builder); // Fluent interface
}
[Fact]
public void WithWorkspacePath_WithNullPath_ShouldNotThrow()
{
// Arrange
var builder = new AgenticEngineBuilder();
// Act - Currently doesn't validate, so it shouldn't throw
Action act = () => builder.WithWorkspacePath(null);
// Assert - This is current behavior, not ideal but documenting it
act.Should().NotThrow();
}
[Fact]
public void WithWorkspacePath_WithEmptyPath_ShouldNotThrow()
{
// Arrange
var builder = new AgenticEngineBuilder();
// Act - Currently doesn't validate, so it shouldn't throw
Action act = () => builder.WithWorkspacePath("");
// Assert - This is current behavior, not ideal but documenting it
act.Should().NotThrow();
}
[Fact]
public void Build_AfterMultipleConfigurations_ShouldApplyAllSettings()
{
// Arrange
var builder = new AgenticEngineBuilder();
var testPath = Path.GetTempPath();
// Act
var engine = builder
.WithWorkspacePath(testPath)
.Build();
// Assert
engine.Should().NotBeNull();
}
}