public void TestThatGetSensorTypeReturnsNull() { CO2Sensor sensor = new CO2Sensor(); string sensorType = sensor.GetSensorType(); Assert.AreNotEqual(string.Empty, sensorType); }
public void TestThatIsTriggeredReturnsTrue() { CO2Sensor sensor = new CO2Sensor(); bool isTriggeredTrue = sensor.Trigger() == true ? true : true; Assert.AreEqual(true, isTriggeredTrue); }
public void TestThatGetLocationReturnsNull() { CO2Sensor sensor = new CO2Sensor(); string location = sensor.GetLocation(); Assert.AreEqual(string.Empty, location); }
public void TestThatIsTriggeredReturnsFalse() { CO2Sensor sensor = new CO2Sensor(); bool isTriggeredFalse = sensor.Trigger() == true ? false : false; Assert.AreEqual(false, isTriggeredFalse); }
public void TestThatGetBatteryPercentageReturnsNegativeOne() { CO2Sensor sensor = new CO2Sensor(); double batteryPercentage = sensor.GetBatteryPercentage(); Assert.AreNotEqual(-1, batteryPercentage); }
public void TestThatGetSensorTypeReturnsType() { CO2Sensor sensor = new CO2Sensor(); string sensorType = sensor.GetSensorType(); Assert.AreEqual("CO2 sensor", sensorType); }
public void TestThatSetLocationReturnsLocation() { CO2Sensor sensor = new CO2Sensor(); sensor.SetLocation("Main Door"); Assert.AreEqual("Main Door", sensor.GetLocation()); sensor.SetLocation("I have changed...change is inevitable"); Assert.AreNotEqual("Main Door", sensor.GetLocation()); Assert.AreEqual("I have changed...change is inevitable", sensor.GetLocation()); }
public void TestThatGetLocationReturnsLocation() { CO2Sensor sensor = new CO2Sensor("Entry"); string location = sensor.GetLocation(); Assert.AreEqual("Entry", location); CO2Sensor sensor_2 = new CO2Sensor("Kitchen"); string location_2 = sensor_2.GetLocation(); Assert.AreEqual("Kitchen", location_2); }
public void TestThatIsTriggeredCanReturnTrue() { CO2Sensor sensor = new CO2Sensor(); List <bool> results = new List <bool>(); for (var i = 0; i <= 1000; i++) { results.Add(sensor.Trigger()); } Assert.AreEqual(true, results.Contains(true)); }
private static void datalog() { while (true) { fileLog = new FileLogger("file.log"); // Crea ed utilizza un ADC. Il codice del ADC utilizzerà un gestore del bus SPI adc = new DigitalConverterMCP3208(); lux = new LightSensor(adc, 0, 3.3); temp = new TemperatureSensor(adc, 1, 3.3); moisture = new SoilMoistureSensor(adc, 2, 3.3); co2 = new CO2Sensor(adc, 3, 4.9); rh = new RelativeHumiditySensor(adc, 4, 5.0); shift = new OutShiftRegister(16, 25, 24, 23); lcd = new LCD1602Shift(shift, 12, 11, 10, 9, 13, 14); irrigator = new Device_OnOffShift(shift, 8); ////////irrigator.WriteLog += WriteFileLog; humidifier = new Device_OnOffShift(shift, 2); ////////humidifier.WriteLog += WriteFileLog; lightDevice = new LightDevice(shift, 3, 4, 5, 6, 7, 21, 20); lightDevice.PercentualeApertura(50); //irrigator.TimeOn(3000); //_timer = new DispatcherTimer(); //_timer.Interval = TimeSpan.FromMilliseconds(1000); //_timer.Tick += Timer_Tick; //if (_pin != null) //{ // _timer.Start(); //} } }