< Summary

Information
Class: WebApi.Services.IOTControlService
Assembly: IndeklimaWebApi
File(s): /home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Services/IOTControlService.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 25
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
ShouldWindowOpen(...)100%11100%
AreDesiredValuesReached(...)100%11100%

File(s)

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

#LineLine coverage
 1namespace WebApi.Services;
 2
 3public class IOTControlService : IIOTControlService
 4{
 5
 6    public bool ShouldWindowOpen(double currentTemperature, double desiredTemperature, double currentHumidity, double de
 47    {
 48        bool shouldOpenForTemperature = currentTemperature > desiredTemperature;
 49        bool shouldOpenForHumidity = currentHumidity > desiredHumidity;
 410        bool shouldOpenForCo2 = currentCo2 > desiredCo2;
 11
 12        // Open the window if any of the conditions are met
 413        return shouldOpenForTemperature || shouldOpenForHumidity || shouldOpenForCo2;
 414    }
 15
 16    public bool AreDesiredValuesReached(double currentTemp, double desiredTemp, double currentHumidity, double desiredHu
 217    {
 218        bool temperatureReached = currentTemp <= desiredTemp;
 219        bool humidityReached = currentHumidity <= desiredHumidity;
 220        bool co2Reached = currentCo2 <= desiredCo2;
 21
 22        // All desired values need to be reached
 223        return temperatureReached && humidityReached && co2Reached;
 224    }
 25}