Exemple #1
0
        public void TryParseDecimalThatOverFlowsShouldBeFalse()
        {
            decimal?result;

            Assert.True(EdmValueParser.TryParseDecimal("-79228162514264337593543950335", out result));
            Assert.Equal(decimal.MinValue, result);
            Assert.False(EdmValueParser.TryParseDecimal("-79228162514264337593543950336", out result));
            Assert.Null(result);
        }
Exemple #2
0
        public void TryParseDecimalThatOverFlowsShouldBeFalse()
        {
            decimal?result;

            EdmValueParser.TryParseDecimal("-79228162514264337593543950335", out result).Should().BeTrue();
            result.Should().Be(decimal.MinValue);
            EdmValueParser.TryParseDecimal("-79228162514264337593543950336", out result).Should().BeFalse();
            result.Should().NotHaveValue();
        }
Exemple #3
0
        private IEnumerable <EdmError> ComputeErrors()
        {
            decimal?value;

            if (!EdmValueParser.TryParseDecimal(this.expression.Value, out value))
            {
                return(new EdmError[] { new EdmError(this.Location, EdmErrorCode.InvalidDecimal, Edm.Strings.ValueParser_InvalidDecimal(this.expression.Value)) });
            }
            else
            {
                return(Enumerable.Empty <EdmError>());
            }
        }
Exemple #4
0
        private decimal ComputeValue()
        {
            decimal?nullable;

            if (EdmValueParser.TryParseDecimal(this.expression.Value, out nullable))
            {
                return(nullable.Value);
            }
            else
            {
                return(new decimal(0));
            }
        }
Exemple #5
0
        private IEnumerable <EdmError> ComputeErrors()
        {
            decimal?nullable;

            if (EdmValueParser.TryParseDecimal(this.expression.Value, out nullable))
            {
                return(Enumerable.Empty <EdmError>());
            }
            else
            {
                EdmError[] edmError = new EdmError[1];
                edmError[0] = new EdmError(base.Location, EdmErrorCode.InvalidDecimal, Strings.ValueParser_InvalidDecimal(this.expression.Value));
                return(edmError);
            }
        }
Exemple #6
0
        private decimal ComputeValue()
        {
            decimal?value;

            return(EdmValueParser.TryParseDecimal(this.expression.Value, out value) ? value.Value : 0);
        }