< Summary

Information
Class: WebApi.Services.SensorGoalService
Assembly: IndeklimaWebApi
File(s): /home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Services/SensorGoalService.cs
Line coverage
100%
Covered lines: 27
Uncovered lines: 0
Coverable lines: 27
Total lines: 51
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
.ctor(...)100%11100%
GetSensorGoalAsync()100%11100%
AddOrUpdateSensorGoalAsync()100%11100%
DeleteSensorGoalAsync()100%11100%

File(s)

/home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Services/SensorGoalService.cs

#LineLine coverage
 1using WebApi.DAO;
 2using WebApi.Models;
 3
 4namespace WebApi.Services
 5{
 6    public class SensorGoalService : ISensorGoalService
 7    {
 8        private readonly ISensorGoalDAO _sensorGoalDAO;
 9
 610        public SensorGoalService(ISensorGoalDAO sensorGoalDAO)
 611        {
 612            _sensorGoalDAO = sensorGoalDAO;
 613        }
 14
 15        public async Task<SensorGoal?> GetSensorGoalAsync(int hallId)
 216        {
 17            try
 218            {
 219                return await _sensorGoalDAO.GetSensorGoalAsync(hallId);
 20            }
 121            catch (Exception ex)
 122            {
 123                throw new Exception($"Error retrieving sensor goal: {ex.Message}");
 24            }
 125        }
 26
 27        public async Task AddOrUpdateSensorGoalAsync(SensorGoal sensorGoal)
 228        {
 29            try
 230            {
 231                await _sensorGoalDAO.AddOrUpdateSensorGoalAsync(sensorGoal);
 132            }
 133            catch (Exception ex)
 134            {
 135                throw new Exception($"Error adding or updating sensor goal: {ex.Message}");
 36            }
 137        }
 38
 39        public async Task DeleteSensorGoalAsync(int hallId)
 240        {
 41            try
 242            {
 243                await _sensorGoalDAO.DeleteSensorGoalAsync(hallId);
 144            }
 145            catch (Exception ex)
 146            {
 147                throw new Exception($"Error deleting sensor goal: {ex.Message}");
 48            }
 149        }
 50    }
 51}