private static void FullTestNonExistingSensorInfo(string productName, string sensorPath, IsSensorRegistered isSensorReqistered, GetSensorInfo getSensorInfo, GetProductSensors getProductSensors, GetSensorInfoFromDB getSensorInfoFromDB) { Assert.False(isSensorReqistered(productName, sensorPath)); Assert.Null(getSensorInfo(productName, sensorPath)); Assert.Null(getProductSensors(productName)?.FirstOrDefault(s => s.Path == sensorPath)); Assert.Null(getSensorInfoFromDB(productName, sensorPath)); }
private static void FullTestSensorInfo(string productName, SensorValueBase sensorValue, IsSensorRegistered isSensorRegistered, GetSensorInfo getSensorInfo, GetProductSensors getProductSensors, GetSensorInfoFromDB getSensorFromDB, SensorValuesTester tester) { var sensorValuePath = sensorValue.Path; Assert.True(isSensorRegistered(productName, sensorValuePath)); tester.TestSensorInfoFromDB(sensorValue, getSensorInfo(productName, sensorValuePath)); tester.TestSensorInfoFromDB(sensorValue, getProductSensors(productName).FirstOrDefault(s => s.Path == sensorValuePath)); tester.TestSensorInfoFromDB(sensorValue, getSensorFromDB(productName, sensorValuePath)); }
private void TestSensorInfoFromDB(SensorValueBase sensorValue, GetSensorInfo getSensorInfo) { var sensorInfoFromDB = getSensorInfo?.Invoke(_testProductName, sensorValue.Path); _sensorValuesTester.TestSensorInfoFromDB(sensorValue, sensorInfoFromDB); }
private async Task FullSensorValueTestAsync(SensorValueBase sensorValue, GetValuesFromCache getCachedValues, GetSensorHistoryData getSensorHistoryData, GetSensorInfo getSensorInfo) { await Task.Delay(100); TestSensorDataFromCache(sensorValue, getCachedValues); TestSensorHistoryDataFromDB(sensorValue, getSensorHistoryData); TestSensorInfoFromDB(sensorValue, getSensorInfo); }
private static void FullTestRemovedSensor(string productName, SensorValueBase sensorValue, IsSensorRegistered isSensorRegistered, GetSensorInfo getSensorInfo, GetProductSensors getProductSensors, GetQueueValues getQueueValues, GetAllSensorHistory getAllSensorHistory, GetSensorInfoFromDB getSensorFromDB, SensorValuesTester tester) { string sensorValuePath = sensorValue.Path; Assert.False(isSensorRegistered(productName, sensorValuePath)); Assert.Null(getSensorInfo(productName, sensorValuePath)); Assert.Null(getProductSensors(productName).FirstOrDefault(s => s.Path == sensorValuePath)); Assert.Empty(getQueueValues(new List <string>() { productName })); Assert.Empty(getAllSensorHistory(productName, sensorValuePath)); tester.TestSensorInfoFromDB(sensorValue, getSensorFromDB(productName, sensorValuePath)); }