private BaseRule CreateRule(string ruleName) { BaseRule baseRule = null; switch (ruleName) { case "DataType": { baseRule = new DataTypeRule(); break; } case "Required": { baseRule = new MandatoryRule(); break; } case "DataPattern": { baseRule = new DataPatternRule(); break; } case "MaxLength": { baseRule = new DataLengthRule(); break; } case "Reference": { baseRule = new ReferenceRule(); break; } case "Hierarchy": { baseRule = new HierarchyRule(); break; } case "DelimitedHierarchy": { baseRule = new DelimitedHierarchyRule(); break; } case "List": { baseRule = new ListConstraintRule(); break; } } return(baseRule); }
public void ReferenceRulesCanBeCreatedFluentlyToo() { var rule = ReferenceRule.For("*") .Referencing("Chabis.*") .IsForbidden() .Because("Nothing should reference Chabis") .BuildRule(); AssertReferenceRules(rule); }