refactor: extract interfaces to Interfaces folders and consolidate filters
Move interface declarations into per-area Interfaces/ subfolders, merge the small task-list filter classes into StatusFilter/SmartFlagFilter, and simplify related services, converters and hub DTO handling. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ public sealed class SmartFilterTests
|
||||
[Fact]
|
||||
public void MyDay_matches_my_day_tasks_regardless_of_status()
|
||||
{
|
||||
var f = new MyDayFilter();
|
||||
var f = new SmartFlagFilter("smart:my-day", t => t.IsMyDay);
|
||||
Assert.True (f.Matches(TaskFactory.Make("a", isMyDay: true, status: TaskStatus.Idle)));
|
||||
Assert.True (f.Matches(TaskFactory.Make("b", isMyDay: true, status: TaskStatus.Done)));
|
||||
Assert.False(f.Matches(TaskFactory.Make("c", isMyDay: false, status: TaskStatus.Idle)));
|
||||
@@ -17,7 +17,7 @@ public sealed class SmartFilterTests
|
||||
[Fact]
|
||||
public void MyDay_count_excludes_done()
|
||||
{
|
||||
var f = new MyDayFilter();
|
||||
var f = new SmartFlagFilter("smart:my-day", t => t.IsMyDay);
|
||||
Assert.True (f.ShouldCount(TaskFactory.Make("a", isMyDay: true, status: TaskStatus.Queued)));
|
||||
Assert.False(f.ShouldCount(TaskFactory.Make("b", isMyDay: true, status: TaskStatus.Done)));
|
||||
Assert.False(f.ShouldCount(TaskFactory.Make("c", isMyDay: false, status: TaskStatus.Idle)));
|
||||
@@ -26,7 +26,7 @@ public sealed class SmartFilterTests
|
||||
[Fact]
|
||||
public void Important_uses_IsStarred_with_same_split()
|
||||
{
|
||||
var f = new ImportantFilter();
|
||||
var f = new SmartFlagFilter("smart:important", t => t.IsStarred);
|
||||
Assert.True (f.Matches (TaskFactory.Make("a", isStarred: true, status: TaskStatus.Done)));
|
||||
Assert.False(f.ShouldCount(TaskFactory.Make("a", isStarred: true, status: TaskStatus.Done)));
|
||||
Assert.True (f.ShouldCount(TaskFactory.Make("b", isStarred: true, status: TaskStatus.Queued)));
|
||||
@@ -36,7 +36,7 @@ public sealed class SmartFilterTests
|
||||
[Fact]
|
||||
public void Planned_uses_ScheduledFor_with_same_split()
|
||||
{
|
||||
var f = new PlannedFilter();
|
||||
var f = new SmartFlagFilter("smart:planned", t => t.ScheduledFor != null);
|
||||
var when = DateTime.Today;
|
||||
Assert.True (f.Matches (TaskFactory.Make("a", scheduled: when, status: TaskStatus.Done)));
|
||||
Assert.False(f.ShouldCount(TaskFactory.Make("a", scheduled: when, status: TaskStatus.Done)));
|
||||
|
||||
@@ -8,11 +8,11 @@ public sealed class TaskListFilterRegistryTests
|
||||
private readonly TaskListFilterRegistry _registry = new();
|
||||
|
||||
[Theory]
|
||||
[InlineData("smart:my-day", typeof(MyDayFilter))]
|
||||
[InlineData("smart:important", typeof(ImportantFilter))]
|
||||
[InlineData("smart:planned", typeof(PlannedFilter))]
|
||||
[InlineData("virtual:queued", typeof(QueuedFilter))]
|
||||
[InlineData("virtual:running", typeof(RunningFilter))]
|
||||
[InlineData("smart:my-day", typeof(SmartFlagFilter))]
|
||||
[InlineData("smart:important", typeof(SmartFlagFilter))]
|
||||
[InlineData("smart:planned", typeof(SmartFlagFilter))]
|
||||
[InlineData("virtual:queued", typeof(StatusFilter))]
|
||||
[InlineData("virtual:running", typeof(StatusFilter))]
|
||||
[InlineData("virtual:review", typeof(ReviewFilter))]
|
||||
public void Resolves_known_built_in_filters(string id, Type expected)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed class VirtualFilterTests
|
||||
[Fact]
|
||||
public void Queued_matches_every_queued_task_regardless_of_parent()
|
||||
{
|
||||
var f = new QueuedFilter();
|
||||
var f = new StatusFilter("virtual:queued", TaskStatus.Queued);
|
||||
Assert.True (f.Matches(TaskFactory.Make("a", status: TaskStatus.Queued)));
|
||||
Assert.True (f.Matches(TaskFactory.Make("b", status: TaskStatus.Queued, parentId: "p")));
|
||||
Assert.False(f.Matches(TaskFactory.Make("c", status: TaskStatus.Running)));
|
||||
@@ -21,7 +21,7 @@ public sealed class VirtualFilterTests
|
||||
public void Queued_count_equals_match_for_top_level_and_children_alike()
|
||||
{
|
||||
// The point of the consolidation: counter must agree with display set.
|
||||
var f = new QueuedFilter();
|
||||
var f = new StatusFilter("virtual:queued", TaskStatus.Queued);
|
||||
var orphan = TaskFactory.Make("o", status: TaskStatus.Queued, parentId: "missing");
|
||||
Assert.True(f.Matches(orphan));
|
||||
Assert.True(f.ShouldCount(orphan));
|
||||
@@ -30,7 +30,7 @@ public sealed class VirtualFilterTests
|
||||
[Fact]
|
||||
public void Queued_planning_parent_with_queued_kid_is_context_match()
|
||||
{
|
||||
var f = new QueuedFilter();
|
||||
var f = new StatusFilter("virtual:queued", TaskStatus.Queued);
|
||||
var parent = TaskFactory.Make("p", phase: PlanningPhase.Active, status: TaskStatus.Done);
|
||||
var kid = TaskFactory.Make("k", parentId: "p", status: TaskStatus.Queued);
|
||||
var all = new List<TaskEntity> { parent, kid };
|
||||
@@ -42,7 +42,7 @@ public sealed class VirtualFilterTests
|
||||
[Fact]
|
||||
public void Queued_non_planning_parent_is_never_context_match()
|
||||
{
|
||||
var f = new QueuedFilter();
|
||||
var f = new StatusFilter("virtual:queued", TaskStatus.Queued);
|
||||
var parent = TaskFactory.Make("p", phase: PlanningPhase.None, status: TaskStatus.Done);
|
||||
var kid = TaskFactory.Make("k", parentId: "p", status: TaskStatus.Queued);
|
||||
var all = new List<TaskEntity> { parent, kid };
|
||||
@@ -53,7 +53,7 @@ public sealed class VirtualFilterTests
|
||||
[Fact]
|
||||
public void Queued_planning_parent_without_queued_kid_is_not_context_match()
|
||||
{
|
||||
var f = new QueuedFilter();
|
||||
var f = new StatusFilter("virtual:queued", TaskStatus.Queued);
|
||||
var parent = TaskFactory.Make("p", phase: PlanningPhase.Active);
|
||||
var kid = TaskFactory.Make("k", parentId: "p", status: TaskStatus.Done);
|
||||
var all = new List<TaskEntity> { parent, kid };
|
||||
@@ -66,7 +66,7 @@ public sealed class VirtualFilterTests
|
||||
[Fact]
|
||||
public void Running_matches_and_context_mirror_queued()
|
||||
{
|
||||
var f = new RunningFilter();
|
||||
var f = new StatusFilter("virtual:running", TaskStatus.Running);
|
||||
var parent = TaskFactory.Make("p", phase: PlanningPhase.Active);
|
||||
var kid = TaskFactory.Make("k", parentId: "p", status: TaskStatus.Running);
|
||||
var all = new List<TaskEntity> { parent, kid };
|
||||
|
||||
Reference in New Issue
Block a user