Files
Flypaper/test/Flypaper.Tests/Mcp/QueryPeriodTests.cs
T
TomandClaude Opus 5.5 49a8fa1154
Build and deploy / build (push) Successful in 1m31s
Build and deploy / deploy (push) Successful in 20s
Add read-only MCP server with token access
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:34:16 +01:00

37 lines
926 B
C#

using Flypaper.Storage.Queries;
using Shouldly;
namespace Flypaper.Tests.Mcp;
public sealed class QueryPeriodTests
{
[Theory]
[InlineData("30m", 0.5)]
[InlineData("1h", 1)]
[InlineData("24H", 24)]
[InlineData("7d", 168)]
[InlineData("2w", 336)]
public void Parses_relative_periods(string value, double hours)
{
QueryPeriod.TryParse(value, out var span).ShouldBeTrue();
span.ShouldBe(TimeSpan.FromHours(hours));
}
[Theory]
[InlineData("all")]
[InlineData("")]
[InlineData(null)]
public void Treats_all_as_unbounded(string? value)
{
QueryPeriod.TryParse(value, out var span).ShouldBeTrue();
span.ShouldBeNull();
}
[Theory]
[InlineData("0d")]
[InlineData("1y")]
[InlineData("1.5h")]
[InlineData("h")]
public void Rejects_other_values(string value) => QueryPeriod.TryParse(value, out _).ShouldBeFalse();
}