< Summary

Information
Class: KT.Modules.Alarm.Core.Application.DeviceTokenService
Assembly: KT.Modules.Alarm
File(s): G:\NetProjects\KeepTrack\src\Modules\KT.Modules.Alarm\Core\Application\DeviceTokenService.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 28
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
DeleteAsync(...)100%22100%
GetAsync()100%22100%
SaveAsync()100%66100%

File(s)

G:\NetProjects\KeepTrack\src\Modules\KT.Modules.Alarm\Core\Application\DeviceTokenService.cs

#LineLine coverage
 1using KT.Modules.Security.Presentation.Contracts;
 2using KT.Modules.Security.Presentation.Dto;
 3using Microsoft.Extensions.DependencyInjection;
 4
 5namespace KT.Modules.Alarm.Core.Application
 6{
 107    internal class DeviceTokenService([FromKeyedServices("securityModule")] IDeviceTokenService deviceTokenService) : ID
 8    {
 9        public Task<bool> DeleteAsync(string token)
 310        {
 311            if (string.IsNullOrEmpty(token))
 212                return Task.FromResult(false);
 113            return deviceTokenService.DeleteAsync(token);
 314        }
 15        public async Task<string> GetAsync(string userId)
 216        {
 217            if (string.IsNullOrEmpty(userId))
 118                throw new ArgumentException("UserId cannot be null or empty");
 119            return await deviceTokenService.GetAsync(userId);
 120        }
 21        public async Task SaveAsync(DeviceTokenDto deviceToken)
 522        {
 523            if (deviceToken == null || string.IsNullOrEmpty(deviceToken.UserId) || string.IsNullOrEmpty(deviceToken.Toke
 424                throw new ArgumentException("DeviceToken, Username, and Token cannot be null or empty");
 125            await deviceTokenService.SaveAsync(deviceToken);
 126        }
 27    }
 28}