Beispiel #1
0
        public void Validates_properties_from_same_entity()
        {
            var entityType1 = new Model().AddEntityType(typeof(Customer));
            var entityType2 = new Model().AddEntityType(typeof(Order));
            var property1   = entityType1.GetOrAddProperty(Customer.IdProperty);
            var property2   = entityType2.GetOrAddProperty(Order.NameProperty);

            Assert.Equal(CoreStrings.KeyPropertiesWrongEntity($"{{'{property1.Name}', '{property2.Name}'}}", entityType1.DisplayName()),
                         Assert.Throws <ArgumentException>(
                             () => entityType1.AddKey(new[] { property1, property2 })).Message);
        }