예제 #1
0
        public void Setting_ClrType_throws_when_referenced()
        {
            var entityType = new Model().AddEntityType(typeof(object));
            var principalProperty = entityType.AddProperty("Kake");
            var key = entityType.AddKey(principalProperty);
            var dependentProperty = entityType.AddProperty("Alaska");
            entityType.AddForeignKey(dependentProperty, key, entityType);

            Assert.Equal(CoreStrings.PropertyClrTypeCannotBeChangedWhenReferenced("Kake", "{'Alaska'}", "object"),
                Assert.Throws<InvalidOperationException>(() =>
                    principalProperty.ClrType = typeof(int)).Message);
            Assert.Equal(typeof(string), ((IProperty)principalProperty).ClrType);
        }