< Summary

Information
Class: WebApi.Services.SensorDataService
Assembly: IndeklimaWebApi
File(s): /home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Services/SensorDataService.cs
Line coverage
63%
Covered lines: 14
Uncovered lines: 8
Coverable lines: 22
Total lines: 51
Line coverage: 63.6%
Branch coverage
100%
Covered branches: 2
Total branches: 2
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%
GetSensorData()100%11100%
AddSensorDataAsync()100%22100%
GetSensorData()100%210%
GetSensorData()100%210%

File(s)

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

#LineLine coverage
 1using Microsoft.AspNetCore.Mvc;
 2using WebApi.DAO;
 3using WebApi.Models;
 4
 5namespace WebApi.Services
 6{
 7    public class SensorDataService : ISensorDataService
 8
 9    {
 10        private readonly ISensorDataDAO _sensorDataDao;
 11
 312        public SensorDataService(ISensorDataDAO sensorDataDao)
 313        {
 314            _sensorDataDao = sensorDataDao;
 315        }
 16        public async Task<List<SensorData>> GetSensorData(int hallId)
 117        {
 118            if (hallId == null)
 19            {
 20                throw new ArgumentNullException(nameof(hallId));
 21            }
 122            return await _sensorDataDao.GetSensorDataAsync(hallId);
 123        }
 24
 25        public async Task AddSensorDataAsync(SensorData sensorData)
 226        {
 227            if (sensorData == null)
 128            {
 129                throw new ArgumentNullException(nameof(sensorData));
 30            }
 131            await _sensorDataDao.AddSensorDataAsync(sensorData);
 132        }
 33        public async Task<List<SensorData>> GetSensorData(int hallId, int limit)
 034        {
 035            return await _sensorDataDao.GetSensorDataAsync(hallId, limit);
 036        }
 37        public async Task<List<SensorData>> GetSensorData(int hallId, DateTime startDate, DateTime endDate)
 038        {
 039            if (hallId == null)
 40            {
 41                throw new ArgumentNullException(nameof(hallId));
 42            }
 043            if (startDate == null || endDate == null)
 44            {
 45                throw new ArgumentNullException(nameof(startDate));
 46            }
 47
 048            return await _sensorDataDao.GetSensorDataAsync(hallId, startDate, endDate);
 049        }
 50    }
 51}