public void verify_method_ConvertBack_returns_correct_value()
        {
            var dtsConverter = new DoubleToStringConverter();

            Assert.That(dtsConverter.ConvertBack(
                            s1,   // string to convert (double)
                            typeof(String),
                            null, // no parameters
                            System.Globalization.CultureInfo.CurrentCulture).Equals(d1));
            Assert.That(dtsConverter.ConvertBack(
                            s2,   // string to convert (int)
                            typeof(String),
                            null, // no parameters
                            System.Globalization.CultureInfo.CurrentCulture).Equals((double)i1));
            Assert.That(dtsConverter.ConvertBack(
                            "t",  // string to convert (NaN)
                            typeof(String),
                            null, // no parameters
                            System.Globalization.CultureInfo.CurrentCulture).Equals(0));
            var exception = Assert.Throws <ArgumentException>(() => dtsConverter.ConvertBack(
                                                                  12,   // int value
                                                                  typeof(String),
                                                                  null, // no parameters
                                                                  System.Globalization.CultureInfo.CurrentCulture));

            Assert.That(exception.Message, Is.EqualTo(StringLookup.GetLocalizedString("Exception_String")));
        }
        public void ConvertBack_NumberString_AppropriateDoubleNumber()
        {
            //arrange
            double expected = 36.457;

            //action
            double actual = (double)Target.ConvertBack("36.457", typeof(Double), null, CultureInfo.InvariantCulture);

            //assert
            Assert.AreEqual(expected, actual);
        }
        public void ConvertBack_NumericString_ReturnsNumber()
        {
            var converter = new DoubleToStringConverter();

            var result = converter.ConvertBack("3,14", null, null, null);

            Assert.AreEqual(3.14, result);
        }
        public void ConvertBack_NonNumericString_ReturnsZero()
        {
            var converter = new DoubleToStringConverter();

            var result = converter.ConvertBack("hello", null, null, null);

            Assert.AreEqual(0, result);
        }
        public void ShouldReturnUnsetValueIfConvertingBackNull()
        {
            var result = _converter.ConvertBack(null, typeof(string), null, CultureInfo.InvariantCulture);

            Assert.AreEqual(DependencyProperty.UnsetValue, result);
        }