Пример #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));
        }