Skip to content

TT: Think about how to test date filtering #69

@MDI74

Description

@MDI74

Think about how to test date filtering in GetTaskEntriesQuery

public Task<List<TaskEntry>> GetAsync(
        long projectId,
        DateOnly startDate,
        DateOnly endDate
    )
    {
        return _context
            .QueryableWithinTenantAsNoTracking<TaskEntry>()
            .Where(x => x.ProjectId == projectId)
            .Where(x => x.StartTime >= startDate.ToDateTime(TimeOnly.MinValue) && x.EndTime <= endDate.ToDateTime(TimeOnly.MaxValue))
            .ToListAsync();
    }

Comment from Alex

Create a follow up task to carefully test how ToDateTime works and this check in particular. Need to decide what kind of tests are needed.
There is also a bug that both start and end are checking including themselves. >= and <=.
One of this should be exclusive. E.g. >= and <.
Or maybe TimeOnly.MinValue and TimeOnly.MaxValue solved this already?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions