< Summary

Information
Class: Safarimacik.Model.TimerAdapter
Assembly: Safarimacik
File(s): /builds/szofttech-ab-2025/group-03/safarimacik/model/TimerAdapter.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 27
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_Interval()100%210%
set_Interval(...)100%11100%
get_Enabled()100%11100%
set_Enabled(...)100%210%
Start()100%11100%
Stop()100%11100%
Dispose()100%11100%

File(s)

/builds/szofttech-ab-2025/group-03/safarimacik/model/TimerAdapter.cs

#LineLine coverage
 1namespace Safarimacik.Model;
 2
 3
 4/// <summary>
 5/// Represents a timer realizing ITimerAdapter.
 6/// </summary>
 7public class TimerAdapter : ITimerAdapter {
 18  private readonly System.Timers.Timer _timer = new();
 9
 10  public event EventHandler<TimerElapsedEventArgs>? Elapsed;
 11
 112  public double Interval { get => _timer.Interval; set => _timer.Interval = value; }
 113  public bool Enabled { get => _timer.Enabled; set => _timer.Enabled = value; }
 14
 115  public TimerAdapter() {
 116    _timer.Elapsed += (s, e) => Elapsed?.Invoke(s, new TimerElapsedEventArgs(e.SignalTime));
 117  }
 18
 119  public void Start() => _timer.Start();
 20
 121  public void Stop() => _timer.Stop();
 22
 123  public void Dispose() {
 124    _timer.Dispose();
 125    GC.SuppressFinalize(this);
 126  }
 27}