public void CanAssignDoubleInDeCulture()
        {
            string parameterName = "p1Dbl";

            const double doubleValue          = 0.123d;
            const string stringValueInvariant = "0.123";

            Type dataType           = typeof(double);
            var  testParameterValue = new ScalarTestParameterValue(parameterName, dataType);

            string stringValueDe = null;

            CultureInfoUtils.ExecuteUsing("de-DE",
                                          () =>
            {
                stringValueDe = doubleValue.ToString(
                    CultureInfo.CreateSpecificCulture("DE-de"));
                testParameterValue.StringValue = stringValueDe;
            });

            Assert.AreEqual(stringValueInvariant, testParameterValue.PersistedStringValue);

            testParameterValue.SetValue(doubleValue);
            Assert.AreEqual(stringValueInvariant, testParameterValue.PersistedStringValue);

            CultureInfoUtils.ExecuteUsing("de-DE",
                                          () =>
            {
                Assert.AreEqual(stringValueDe,
                                testParameterValue.GetDisplayValue());
            });
        }
        private static void EnsureDisplayValue(Type dataType,
                                               string stringValueCurrentCulture)
        {
            const string parameterName = "Test";

            var testParameterValue = new ScalarTestParameterValue(parameterName, dataType);

            testParameterValue.SetStringValue(stringValueCurrentCulture);

            string valueWithKnownDatatype = testParameterValue.GetDisplayValue();

            Assert.AreEqual(stringValueCurrentCulture, valueWithKnownDatatype);

            object value = testParameterValue.GetValue();

            Assert.NotNull(value);

            string persistedValue = testParameterValue.PersistedStringValue;

            testParameterValue.DataType = null;

            string valueWithGuessedDatatype = testParameterValue.GetDisplayValue();

            Assert.AreEqual(stringValueCurrentCulture, valueWithGuessedDatatype);

            // Now set the same value using InvariantCulture and try again:
            testParameterValue = new ScalarTestParameterValue(parameterName, dataType);
            testParameterValue.SetStringValue(persistedValue, CultureInfo.InvariantCulture);

            valueWithKnownDatatype = testParameterValue.GetDisplayValue();

            Assert.AreEqual(stringValueCurrentCulture, valueWithKnownDatatype);

            testParameterValue.DataType = null;

            valueWithGuessedDatatype = testParameterValue.GetDisplayValue();

            Assert.AreEqual(stringValueCurrentCulture, valueWithGuessedDatatype);
        }