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); }
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)); }
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); }
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); }