public void GetDoubleValue_TooManyDecimals_DecimalIsTrimmed()
        {
            const double validSize = 124.99543D;

            string result = BaseTypeHelper.GetDoubleValue(validSize);

            Assert.Equal("124.9954", result);
        }
        public void GetDoubleValue_SizeIsAcceptable_ReturnsSize()
        {
            const double validSize = 124.99D;

            string result = BaseTypeHelper.GetDoubleValue(validSize);

            Assert.Equal("124.9900", result);
        }
        public void GetDecimalValue_SizeExceedsMax_ReturnsMaxAllowedValue()
        {
            const string  maxZabbixMySqlValue = "999000000000.0000";
            const decimal exceedsMaxSize      = 999999999999.9999m;

            string result = BaseTypeHelper.GetDecimalValue(exceedsMaxSize);

            Assert.Equal(maxZabbixMySqlValue, result);
        }
        public void GetDoubleValue_SizeExceedsMin_ReturnsMinAllowedValue()
        {
            const string minZabbixMySqlValue = "-999000000000.0000";
            const double exceedsMinSize      = -999999999999.9999D;

            string result = BaseTypeHelper.GetDoubleValue(exceedsMinSize);

            Assert.Equal(minZabbixMySqlValue, result);
        }
Beispiel #5
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));
        }