Example #1
0
        public void TestDateConstant()
        {
            var constant = new EdmDateConstant(new Date());
            Assert.AreEqual(EdmValueKind.Date, constant.ValueKind, "Invalid value kind.");

            this.ValidateEdmValueKindRoundTrip(EdmValueKind.Date, EdmCoreModel.Instance.GetDate(true), constant);
        }
        public void EdmDateConstant()
        {
            var e = new EdmDateConstant(new Date(2014, 8, 8));
            Assert.AreEqual(EdmExpressionKind.DateConstant, e.ExpressionKind, "e.ExpressionKind");
            Assert.IsNull(e.Type, "e.Type");
            Assert.AreEqual(new Date(2014, 8, 8), e.Value, "e.Value");

            e = new EdmDateConstant(EdmCoreModel.Instance.GetDate(true), new Date(2014, 8, 8));
            Assert.AreEqual(e.Type.AsPrimitive().PrimitiveKind(), EdmPrimitiveTypeKind.Date);
            Assert.AreEqual(true, e.Type.IsNullable, "e.Type.IsNullable");
            Assert.AreEqual(new Date(2014, 8, 8), e.Value, "e.Value");

            e = new EdmDateConstant(null, new Date(2014, 8, 8));
            Assert.IsNull(e.Type, "e.Type");

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