示例#1
0
    public void ConvertBackTheory(double doubleToConvert, string expected)
    {
        var converter = new StringToDoubleConverter();
        var result    = (string)converter.ConvertBack(doubleToConvert, typeof(string), null, CultureInfo.CurrentCulture);

        Assert.Equal(expected, result);
    }
示例#2
0
    public void ConvertBackNotSupportedType()
    {
        const int intToConvert = 1;
        var       converter    = new StringToDoubleConverter();

        Assert.Throws <InvalidOperationException>(() => converter.ConvertBack(intToConvert, typeof(string), null,
                                                                              CultureInfo.CurrentCulture));
    }
示例#3
0
        public void DoubleToStringConverter(double value, string expectedResult)
        {
            var doubletostring = new StringToDoubleConverter();

            var result = doubletostring.ConvertBack(value, typeof(StringToDoubleConverter_tests), null,
                                                    CultureInfo.CurrentCulture);

            Assert.Equal(result, expectedResult);
        }
        private float ReadValue(string column)
        {
            var value = _table.Rows[(int)_index][column];

            try
            {
                return((float)_converter.ConvertBack(value, typeof(float), null, null));
            }
            catch (Exception e)
            {
                // TODO: Удалить.
                MessageBox.Show(e.ToString());
            }
            return(0);
        }
        private float ToFloat(string text)
        {
            var convertBack = _converter.ConvertBack(text, typeof(float), null, null);

            return(Convert.ToSingle(convertBack));
        }
示例#6
0
        public static double GetDoubleValue(this DoubleUpDown comboBox)
        {
            var converter = new StringToDoubleConverter();

            return((double)converter.ConvertBack(comboBox.Text, typeof(double), null, CultureInfo.InvariantCulture));
        }