using FluentAssertions; using InboxIntel.Application.Search; using Xunit; namespace InboxIntel.UnitTests; public class GmailQueryParserTests { [Fact] public void Parses_operators_and_free_text() { var r = GmailQueryParser.Parse("from:github.com is:unread has:attachment quarterly report"); r.Sender.Should().Be("github.com"); r.IsUnread.Should().BeTrue(); r.HasAttachments.Should().BeTrue(); r.Query.Should().Be("quarterly report"); } [Fact] public void Parses_date_range() { var r = GmailQueryParser.Parse("after:2025-01-01 before:2025-02-01"); r.From.Should().Be(new DateOnly(2025, 1, 1)); r.To.Should().Be(new DateOnly(2025, 2, 1)); } [Fact] public void Empty_query_yields_empty_filters() { var r = GmailQueryParser.Parse(" "); r.Sender.Should().BeNull(); r.Query.Should().BeNull(); } [Fact] public void Is_read_sets_unread_false() { GmailQueryParser.Parse("is:read").IsUnread.Should().BeFalse(); } }