public void ValueTerm_IsType_OnEntityType()
        {
            this.SetupModels();

            IEdmEntityType person = this.baseModel.FindEntityType("NS1.Person");
            IEdmValueTerm termStringValue = this.longDefinitionModel.FindValueTerm("bar.StringValue");
            var isPersonType = new EdmIsTypeExpression(new EdmStringConstant("s1"), new EdmEntityTypeReference(person, true));
            this.CreateAndAttachValueAnnotation(person, termStringValue, isPersonType);

            var isStringType = new EdmIsTypeExpression(new EdmStringConstant("s2"), EdmCoreModel.Instance.GetString(true));
            this.CreateAndAttachValueAnnotation(person, termStringValue, isStringType);

            string expectedCsdl =
@"<Schema Namespace=""NS1"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
    <EntityType Name=""Person"">
        <Key>
            <PropertyRef Name=""Name"" />
        </Key>
        <Property Name=""Name"" Type=""Edm.String"" Nullable=""false"" />
        <Property Name=""Birthday"" Type=""Edm.DateTimeOffset"" Nullable=""false"" />
    </EntityType>
    <Annotations Target=""NS1.Person"">
        <Annotation Term=""bar.StringValue"">
            <IsType Type=""NS1.Person"">
                <String>s1</String>
            </IsType>
        </Annotation>
        <Annotation Term=""bar.StringValue"">
            <IsType Type=""Edm.String"">
                <String>s2</String>
            </IsType>
        </Annotation>
    </Annotations>
</Schema>";
            this.SerializeAndVerifyAgainst(this.baseModel, expectedCsdl);
        }
        public void EdmIsTypeExpression()
        {
            var e = new EdmIsTypeExpression(new EdmStringConstant("qwerty"), EdmCoreModel.Instance.GetBoolean(false));
            Assert.AreEqual(EdmExpressionKind.IsType, e.ExpressionKind, "e.ExpressionKind");
            Assert.AreEqual("qwerty", ((IEdmStringValue)e.Operand).Value, "((IEdmStringValue)e.Operand).Value");
            Assert.AreEqual("Edm.Boolean", e.Type.FullName(), "e.Type.FullName()");
            Assert.IsFalse(e.IsBad(), "e good");

            try
            {
                new EdmIsTypeExpression(null, EdmCoreModel.Instance.GetBoolean(false));
                Assert.Fail("exception expected");
            }
            catch (ArgumentNullException)
            {
            }

            try
            {
                new EdmIsTypeExpression(new EdmStringConstant("qwerty"), null);
                Assert.Fail("exception expected");
            }
            catch (ArgumentNullException)
            {
            }

            var ee = new MutableIsTypeExpression();
            Assert.IsNull(ee.Operand, "ee.Operand");
            Assert.IsNull(ee.Type, "ee.Type");
            Assert.IsTrue(ee.IsBad(), "Expression is bad.");
            Assert.AreEqual(2, ee.Errors().Count(), "Expression has no errors");
        }