private TestCase CreateTestCaseInstance(string name, string value, string description)
        {
            var testCase = new TestCase { StatName = name, StatVal = value };
            if (_metadata == null)
            {
                _metadata = GetMetadata();
            }

            var index = _metadata.Testschema.FindIndex(s => s.Name == name);
            if (index == -1)
            {
                Logger.LogWarn("Cannot find metadata for [{0}]", name);
                return null;
            }                
            var schema = _metadata.Testschema[index];
            if (!schema.Enabled)
            {
                Logger.LogWarn("metadata not enable for [{0}]", name);
                return null;
            }
            
            if (schema.Usedesc || string.IsNullOrWhiteSpace(value) || value.Equals("n/a"))
            {
                if (!string.IsNullOrWhiteSpace(description) && description != "-")
                {
                    testCase.StatVal = description;
                }
            }

            if (schema.Type == "boolean")
            {
                testCase.StatVal = ParseBoolean(testCase.StatVal);
                return testCase;
            }

            if (!string.IsNullOrEmpty(schema.Unit))
            {
                testCase.StatVal = ParseUnit(testCase.StatVal, schema.Unit);
                return testCase;
            }

            if (testCase.StatVal.Length <= 40) return testCase;
           
            //var statVal = testCase.StatVal;
            var mapCode = _metadata.EnumDict.Find(s => s.Test.Contains(name));
            if (mapCode != null)
            {
                foreach (var map in mapCode.Map)
                {                    
                    testCase.StatVal = ReplaceCaseInsensitive(testCase.StatVal, map.Value, "#" + map.ID, map.Display==null);
                }
            }
            
            if (testCase.StatVal.Length <= 40) return testCase;
            Logger.LogWarn("[{0}] value length is over 40 charecter, [{1}]", testCase.StatName, testCase.StatVal);
            testCase.StatVal = testCase.StatVal.Substring(0, 37) + "...";

            return testCase;
        }
        public void MapStatCodeEWM(TestResult testResult)
        {
            foreach (var testCase in testResult.Stats)
            {
                if (_metadata == null)
                {
                    _metadata = GetMetadata();
                }

                var mapCode = _metadata.StatCodeDict.Find(s => s.TestName.Contains(testCase.StatName));
                if (mapCode == null) continue;
                foreach (var map in mapCode.Map)
                {
                    testCase.StatName = map.ID;
                }
            }
        }