< Summary

Information
Class: Pomodoro.Web.Components.History.ActivityItemBase
Assembly: Pomodoro.Web
File(s): /home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Components/History/ActivityItem.razor.cs
Line coverage
100%
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 74
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Formatter()100%11100%
get_Activity()100%11100%
IsValidActivity()100%11100%
GetFormattedTime()100%11100%
GetFormattedDuration()100%11100%
GetSessionTypeDisplay()100%11100%
HasTask()100%11100%
GetTaskName()100%11100%

File(s)

/home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Components/History/ActivityItem.razor.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Components;
 2using Pomodoro.Web.Models;
 3using Pomodoro.Web.Services.Formatters;
 4
 5namespace Pomodoro.Web.Components.History;
 6
 7/// <summary>
 8/// Code-behind for ActivityItem component
 9/// Displays a single activity record
 10/// </summary>
 11public class ActivityItemBase : ComponentBase
 12{
 13    [Inject]
 74314    private ActivityItemFormatter Formatter { get; set; } = null!;
 15
 16    #region Parameters
 17
 18    [Parameter]
 272119    public ActivityRecord Activity { get; set; } = default!;
 20
 21    #endregion
 22
 23    #region Methods for Testing
 24
 25    /// <summary>
 26    /// Checks if the activity is valid
 27    /// </summary>
 28    public bool IsValidActivity()
 229    {
 230        return Formatter.IsValidActivity(Activity);
 231    }
 32
 33    /// <summary>
 34    /// Gets the formatted time for display
 35    /// </summary>
 36    public string GetFormattedTime()
 137    {
 138        return Formatter.GetFormattedTime(Activity);
 139    }
 40
 41    /// <summary>
 42    /// Gets the formatted duration for display
 43    /// </summary>
 44    public string GetFormattedDuration()
 145    {
 146        return Formatter.GetFormattedDuration(Activity);
 147    }
 48
 49    /// <summary>
 50    /// Gets the session type display name
 51    /// </summary>
 52    public string GetSessionTypeDisplay()
 153    {
 154        return Formatter.GetSessionTypeDisplay(Activity);
 155    }
 56
 57    /// <summary>
 58    /// Checks if the activity has an associated task
 59    /// </summary>
 60    public bool HasTask()
 261    {
 262        return Formatter.HasTask(Activity);
 263    }
 64
 65    /// <summary>
 66    /// Gets the task name or default value
 67    /// </summary>
 68    public string GetTaskName()
 269    {
 270        return Formatter.GetTaskName(Activity);
 271    }
 72
 73    #endregion
 74}