public void AddSensorValue(int aSensorId, double aValue, long aTime)
        {
            var sensorValue = new SensorValueInfoImpl(aSensorId, aValue, aTime);
            lock (accessLock) {
                if (!container.ContainsKey(aSensorId)) {
                    container[aSensorId] = new List<ISensorValueInfo>();
                }
                container[aSensorId].Add(sensorValue);
            }

            AlertListeners();
        }
        public static void Convert(ref ISensorValueInfo[] aPositionValues) {
            if (aPositionValues == null || aPositionValues.Length == 0) {
                return;
            }

            var valuesCount = aPositionValues.Length;
            if (aPositionValues[0].GetValue() > aPositionValues[valuesCount - 1].GetValue()) {
                var maxMinSummed = GetMaxMinSummed(aPositionValues);
                var revercedValues = new SensorValueInfoImpl[valuesCount];
                for (var i = 0; i < valuesCount; ++i) {
                    var sourceValue = aPositionValues[i];
                    var reversedValue = -1.0 * aPositionValues[i].GetValue() + maxMinSummed;
                    revercedValues[i] = new SensorValueInfoImpl(aPositionValues[i].GetSensorId(), reversedValue, aPositionValues[i].GetTime());                  
                }

                aPositionValues = revercedValues;
            }            
        }
        public void SensorValueDataWriterSaveData()
        {
            var dataWriter = new NHibernateSensorValueWriter();
            dataWriter.Initialize();

            var rnd = new Random();
            var value = new SensorValueInfoImpl(rnd.Next(), rnd.Next(), rnd.Next());
            dataWriter.WriteSensorValueInfo(value);

            var fromDb = dataWriter.ReadSensorValueEntity(value.GetSensorId(), value.GetTime());

            Assert.IsNotNull(fromDb);
            Assert.AreEqual(value.GetValue(), fromDb.Value);
            Assert.AreEqual(value.GetTime(), fromDb.Time);
            Assert.AreEqual(value.GetSensorId(), fromDb.SensorId);
            Assert.Greater(fromDb.Id, 0);

            dataWriter.Uninitialize();
        }