Exemplo n.º 1
0
        private static object FormatValueAsExpectedString(object value)
        {
            var valueType = value.GetType();

            if (valueType == typeof(DateTime))
            {
                return(DateTimeHelper.Serialize((DateTime)value));
            }

            if (valueType == typeof(bool))
            {
                return(BooleanHelper.Serialize((bool)value));
            }

            if (valueType == typeof(double?))
            {
                return(DoubleHelper.Serialize((double?)value));
            }

            if (valueType == typeof(int?))
            {
                return(IntHelper.Serialize((int?)value));
            }

            return(value.ToString());
        }
Exemplo n.º 2
0
        public void Serialize_DoubleHasValue_ReturnsExpectedString(Tuple <string, double> testCases)
        {
            var value    = testCases.Item2;
            var expected = testCases.Item1;

            var result = DoubleHelper.Serialize(value);

            Assert.That(result, Is.EqualTo(expected));
        }
Exemplo n.º 3
0
        public void Serialize_ValueIsNull_ReturnsEmptyString()
        {
            var result = DoubleHelper.Serialize(null);

            Assert.That(result, Is.Null);
        }