示例#1
0
        private kWhStorage GetStorageProviderForPath(string originalQbxPath)
        {
            var serial    = QbxPathUtils.GetSerialFromPath(originalQbxPath);
            var baseDir   = QbxPathUtils.GetBaseDirFromPath(originalQbxPath);
            var counterId = QbxPathUtils.GetCounterIdFromPath(originalQbxPath);
            var storageId = QbxPathUtils.GetStorageIdFromPath(originalQbxPath);

            return(new kWhStorage(serial, baseDir, counterId, Precision.mWh, storageId));
        }
示例#2
0
        private kWhStorage GetStorageProviderForPath(string originalQbxPath)
        {
            var storageProviderContext = new StorageProviderContext
            {
                SerialNumber = QbxPathUtils.GetSerialFromPath(originalQbxPath),
                CounterId    = QbxPathUtils.GetCounterIdFromPath(originalQbxPath),
                Precision    = Precision.mWh,
                StorageId    = QbxPathUtils.GetStorageIdFromPath(originalQbxPath)
            };

            IOptions <kWhStorageOptions> options = new OptionsWrapper <kWhStorageOptions>(_kWhStorageOptions);

            // Override path.
            options.Value.DataStorePath = QbxPathUtils.GetBaseDirFromPath(originalQbxPath);

            return(new kWhStorage(_loggerFactory, options, storageProviderContext));
        }
示例#3
0
        public void TestGetCounterIdFromPath(string path, int expectedCounterId)
        {
            int counterId = QbxPathUtils.GetCounterIdFromPath(path);

            Assert.That(counterId, Is.EqualTo(expectedCounterId));
        }