public void TryParseDouble_FromFloatAndNullableFloat()
        {
            #region float - full method
            var success = ConvertibleFloatValue.TryParseDouble(DefaultValue);

            Assert.AreEqual(success.ToString("n2"), ConvertibleDoubleValue.ToString("n2"), "Error converting float to double");
            #endregion

            #region float - without DefaultValue param
            success = ConvertibleFloatValue.TryParseDouble();

            Assert.AreEqual(success.ToString("n2"), ConvertibleDoubleValue.ToString("n2"), "Error converting float to double");
            #endregion

            #region float? - full method
            success = ConvertibleNullableFloatValue.TryParseDouble(DefaultValue);
            var invalid1 = ((float?)null).TryParseDouble(DefaultValue);

            Assert.AreEqual(success.ToString("n2"), ConvertibleDoubleValue.ToString("n2"), "Error converting float? to double");
            Assert.AreEqual(invalid1, DefaultValue, "Error converting float? to double");
            #endregion

            #region float? - without DefaultValue param
            success  = ConvertibleNullableFloatValue.TryParseDouble();
            invalid1 = ((float?)null).TryParseDouble();

            Assert.AreEqual(success.ToString("n2"), ConvertibleDoubleValue.ToString("n2"), "Error converting float? to double");
            Assert.AreEqual(invalid1, BasePrimitivesExtensions.GetDefaultDoubleConversionValue(), "Error converting float? to double");
            #endregion
        }
        public void TryParseDouble_FromObject()
        {
            var objectValid   = (object)1;
            var objectInvalid = (object)"a";

            Assert.AreEqual(objectValid.TryParseDouble(), Double.Parse(objectValid.ToString()), "Error converting object value to double");
            Assert.AreEqual(objectInvalid.TryParseDouble(), BasePrimitivesExtensions.GetDefaultDoubleConversionValue(), "Error converting object value to double");

            Assert.AreEqual(objectValid.TryParseDouble(2), Double.Parse(objectValid.ToString()), "Error converting object value to double");
            Assert.AreEqual(objectInvalid.TryParseDouble(2), 2, "Error converting object value to double");
        }
        public void TryParseDoubleArray()
        {
            const string successValue1 = "10";
            const string successValue2 = "20";
            const string errorValue1   = "";
            const string errorValue2   = "a";

            var successByteValues = new[] { successValue1.TryParseDouble(), successValue2.TryParseDouble() };
            var successValues     = new[] { successValue1, successValue2 };
            var errorValues       = new[] { errorValue1, errorValue2 };
            var mixedValues       = new[] { successValue1, successValue2, errorValue1, errorValue2 };

            #region full method (with number format), without default, dont return defult conversion
            var successConversion = string.Join(",", successValues).TryParseDoubleArray(null, false,
                                                                                        BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                                                                                        BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(successConversion, "Error converting string to double array");
            Assert.IsTrue(successConversion.Any(), "Error converting string to double array");
            Assert.IsFalse(successConversion.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(successConversion.Count() == successByteValues.Count(), "Error converting string to double array");

            var falseConversions = string.Join(",", errorValues).TryParseDoubleArray(null, false,
                                                                                     BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                                                                                     BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(falseConversions, "Error converting string to double array");
            Assert.IsFalse(falseConversions.Any(), "Error converting string to double array");

            var mixedConversions = string.Join(",", mixedValues).TryParseDoubleArray(null, false,
                                                                                     BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                                                                                     BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(mixedConversions, "Error converting string to double array");
            Assert.IsFalse(mixedConversions.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(mixedConversions.Count() == successByteValues.Count(), "Error converting string to double array");
            #endregion

            #region partial method (with number format), without default
            successConversion = string.Join(",", successValues).TryParseDoubleArray(null,
                                                                                    BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                                                                                    BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(successConversion, "Error converting string to double array");
            Assert.IsTrue(successConversion.Any(), "Error converting string to double array");
            Assert.IsFalse(successConversion.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(successConversion.Count() == successByteValues.Count(), "Error converting string to double array");

            falseConversions = string.Join(",", errorValues).TryParseDoubleArray(null,
                                                                                 BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                                                                                 BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(falseConversions, "Error converting string to double array");
            Assert.IsFalse(falseConversions.Any(a => !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");

            mixedConversions = string.Join(",", mixedValues).TryParseDoubleArray(null,
                                                                                 BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                                                                                 BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(mixedConversions, "Error converting string to double array");
            Assert.IsFalse(mixedConversions.Any(a => !successByteValues.Contains(a) && !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");
            Assert.IsTrue((mixedConversions.Count() - falseConversions.Count()) == successByteValues.Count(), "Error converting string to double array");
            #endregion

            #region simple method (with number format)
            successConversion = string.Join(",", successValues).TryParseDoubleArray(
                BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(successConversion, "Error converting string to double array");
            Assert.IsTrue(successConversion.Any(), "Error converting string to double array");
            Assert.IsFalse(successConversion.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(successConversion.Count() == successByteValues.Count(), "Error converting string to double array");

            falseConversions = string.Join(",", errorValues).TryParseDoubleArray(
                BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(falseConversions, "Error converting string to double array");
            Assert.IsFalse(falseConversions.Any(a => !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");

            mixedConversions = string.Join(",", mixedValues).TryParseDoubleArray(
                BasePrimitivesExtensions.GetDefaultDoubleNumberStyle(),
                BasePrimitivesExtensions.GetCurrentCulture());
            Assert.IsNotNull(mixedConversions, "Error converting string to double array");
            Assert.IsFalse(mixedConversions.Any(a => !successByteValues.Contains(a) && !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");
            Assert.IsTrue((mixedConversions.Count() - falseConversions.Count()) == successByteValues.Count(), "Error converting string to double array");
            #endregion

            #region full method (without number format), without default, dont return defult conversion
            successConversion = string.Join(",", successValues).TryParseDoubleArray(null, false);
            Assert.IsNotNull(successConversion, "Error converting string to double array");
            Assert.IsTrue(successConversion.Any(), "Error converting string to double array");
            Assert.IsFalse(successConversion.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(successConversion.Count() == successByteValues.Count(), "Error converting string to double array");

            falseConversions = string.Join(",", errorValues).TryParseDoubleArray(null, false);
            Assert.IsNotNull(falseConversions, "Error converting string to double array");
            Assert.IsFalse(falseConversions.Any(a => !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");

            mixedConversions = string.Join(",", mixedValues).TryParseDoubleArray(null, false);
            Assert.IsNotNull(mixedConversions, "Error converting string to double array");
            Assert.IsFalse(mixedConversions.Any(a => !successByteValues.Contains(a) && !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");
            Assert.IsTrue((mixedConversions.Count() - falseConversions.Count()) == successByteValues.Count(), "Error converting string to double array");
            #endregion

            #region partial method (without number format), without default
            successConversion = string.Join(",", successValues).TryParseDoubleArray(null);
            Assert.IsNotNull(successConversion, "Error converting string to double array");
            Assert.IsTrue(successConversion.Any(), "Error converting string to double array");
            Assert.IsFalse(successConversion.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(successConversion.Count() == successByteValues.Count(), "Error converting string to double array");

            falseConversions = string.Join(",", errorValues).TryParseDoubleArray(null);
            Assert.IsNotNull(falseConversions, "Error converting string to double array");
            Assert.IsFalse(falseConversions.Any(a => !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");

            mixedConversions = string.Join(",", mixedValues).TryParseDoubleArray(null);
            Assert.IsNotNull(mixedConversions, "Error converting string to double array");
            Assert.IsFalse(mixedConversions.Any(a => !successByteValues.Contains(a) && !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");
            Assert.IsTrue((mixedConversions.Count() - falseConversions.Count()) == successByteValues.Count(), "Error converting string to double array");
            #endregion

            #region simple method (without number format)
            successConversion = string.Join(",", successValues).TryParseDoubleArray();
            Assert.IsNotNull(successConversion, "Error converting string to double array");
            Assert.IsTrue(successConversion.Any(), "Error converting string to double array");
            Assert.IsFalse(successConversion.Any(a => !successByteValues.Contains(a)), "Error converting string to double array");
            Assert.IsTrue(successConversion.Count() == successByteValues.Count(), "Error converting string to double array");

            falseConversions = string.Join(",", errorValues).TryParseDoubleArray();
            Assert.IsNotNull(falseConversions, "Error converting string to double array");
            Assert.IsFalse(falseConversions.Any(a => !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");

            mixedConversions = string.Join(",", mixedValues).TryParseDoubleArray();
            Assert.IsNotNull(mixedConversions, "Error converting string to double array");
            Assert.IsFalse(mixedConversions.Any(a => !successByteValues.Contains(a) && !a.Equals(BasePrimitivesExtensions.GetDefaultDoubleConversionValue())), "Error converting string to double array");
            Assert.IsTrue((mixedConversions.Count() - falseConversions.Count()) == successByteValues.Count(), "Error converting string to double array");
            #endregion
        }