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

            this.ValidateEdmValueKindRoundTrip(EdmValueKind.Guid, EdmCoreModel.Instance.GetGuid(true), constant);
        }
        public void EdmGuidConstant()
        {
            var e = new EdmGuidConstant(new Guid(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }));
            Assert.AreEqual(EdmExpressionKind.GuidConstant, e.ExpressionKind, "e.ExpressionKind");
            Assert.IsNull(e.Type, "e.Type");
            Assert.AreEqual(new Guid(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }), e.Value, "e.Value");

            e = new EdmGuidConstant(EdmCoreModel.Instance.GetGuid(true), new Guid(new byte[] { 100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }));
            Assert.AreEqual(true, e.Type.IsNullable, "e.Type.IsNullable");
            Assert.AreEqual(new Guid(new byte[] { 100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }), e.Value, "e.Value");

            e = new EdmGuidConstant(null, new Guid(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }));
            Assert.IsNull(e.Type, "e.Type");

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