示例#1
0
        public void GetFloatValue_SizeIsAcceptable_ReturnsSize()
        {
            const float validSize = 124.99f;

            string result = BaseTypeHelper.GetFloatValue(validSize);

            Assert.Equal("124.9900", result);
        }
示例#2
0
        public void GetFloatValue_TooManyDecimals_DecimalIsTrimmed()
        {
            const float validSize = 124.99543f;

            string result = BaseTypeHelper.GetFloatValue(validSize);

            Assert.Equal("124.9954", result);
        }
示例#3
0
        public void GetFloatValue_SizeExceedsMax_ReturnsMaxAllowedValue()
        {
            const string maxZabbixMySqlValue = "990000000000.0000";
            const float  exceedsMaxSize      = 999999999999.9999f;

            string result = BaseTypeHelper.GetFloatValue(exceedsMaxSize);

            Assert.Equal(maxZabbixMySqlValue, result);
        }
示例#4
0
        public static string GetNextValue(string key)
        {
            PerformanceCounter counter;

            if (!Counters.TryGetValue(key, out counter))
            {
                counter = ParseCounter(key);
                Counters.Add(key, counter);
            }
            float value = counter.NextValue();

            return(BaseTypeHelper.GetFloatValue(value));
        }