コード例 #1
0
        public void The_Rule_Fails()
        {
            var mappingSet = new MappingSetImpl();
            var rule = new CheckEntityInheritanceForTablePerSubclassRule();
            var result = rule.Run(mappingSet);

            Assert.That(result.HasWarnings, Is.True);
            Assert.That(result.Issues[0].ErrorLevel, Is.EqualTo(ValidationErrorLevel.Warning));
        }
コード例 #2
0
        public void The_Rule_Passes()
        {
            var mappingSet = new MappingSetImpl();
            var parent = new EntityImpl("Parent");
            var child = new EntityImpl("Child");

            child.Parent = parent;
            var idProperty = new PropertyImpl("ID") { IsKeyProperty = true };
            parent.AddProperty(idProperty);
            child.CopyPropertyFromParent(idProperty);

            mappingSet.EntitySet.AddEntity(parent);
            mappingSet.EntitySet.AddEntity(child);

            var rule = new CheckEntityInheritanceForTablePerSubclassRule();
            var result = rule.Run(mappingSet);

            Assert.That(result.HasIssues, Is.False);
        }
コード例 #3
0
        public void The_Rule_Fails()
        {
            var mappingSet = new MappingSetImpl();
            var parent = new EntityImpl("Parent");
            var child = new EntityImpl("Child");

            child.Parent = parent;
            var idProperty = new PropertyImpl("ID") { IsKeyProperty = true };
            parent.AddProperty(idProperty);

            mappingSet.EntitySet.AddEntity(parent);
            mappingSet.EntitySet.AddEntity(child);

            var rule = new CheckEntityInheritanceForTablePerSubclassRule();
            var result = rule.Run(mappingSet);

            Assert.That(result.Issues, Has.Count(1));

            var issue = result.Issues[0];
            Assert.That(issue.Object, Is.SameAs(child));
            Assert.That(issue.ErrorLevel, Is.EqualTo(ValidationErrorLevel.Error));
            StringAssert.Contains("ID", issue.Description);
        }
コード例 #4
0
        public void The_Rule_Passes()
        {
            var mappingSet = new MappingSetImpl();
            mappingSet.EntitySet.AddEntity(new EntityImpl("Entity1"));
            var rule = new CheckEntityInheritanceForTablePerSubclassRule();
            var result = rule.Run(mappingSet);

            Assert.That(result.HasIssues, Is.False);
        }