Пример #1
0
        public void TestFloatingConstant()
        {
            var constant = new EdmFloatingConstant(11.11);
            Assert.AreEqual(EdmValueKind.Floating, constant.ValueKind, "Invalid value kind.");

            this.ValidateEdmValueKindRoundTrip(EdmValueKind.Floating, EdmCoreModel.Instance.GetDouble(true), constant);
            this.ValidateEdmValueKindRoundTrip(EdmValueKind.Floating, EdmCoreModel.Instance.GetSingle(true), constant);
        }
        public void EdmFloatingConstant()
        {
            var e = new EdmFloatingConstant(11.22);
            Assert.AreEqual(EdmExpressionKind.FloatingConstant, e.ExpressionKind, "e.ExpressionKind");
            Assert.IsNull(e.Type, "e.Type");
            Assert.AreEqual(11.22, e.Value, "e.Value");

            e = new EdmFloatingConstant(EdmCoreModel.Instance.GetDouble(true), 33.22);
            Assert.AreEqual(true, e.Type.IsNullable, "e.Type.IsNullable");
            Assert.AreEqual(33.22, e.Value, "e.Value");

            e = new EdmFloatingConstant(null, 11.22);
            Assert.IsNull(e.Type, "e.Type");

            Assert.IsFalse(e.IsBad(), "Expression not bad.");
            Assert.AreEqual(0, e.Errors().Count(), "Expression has no errors");
        }