Status | ID | Priority | Type |
Closed | 39440 | Major | Question |
Profile | Reply |
samakula AmosClient | Given this sample using DevExpress.ExpressApp.DC; [RuleRequiredField(EmployeeValidationRules.EmployeeNameIsRequired, DefaultContexts.Save)] string Name { get; set; } [RuleValueComparison(EmployeeValidationRules.EmployeeIsAdult, DefaultContexts.Save, ValueComparisonType.GreaterThanOrEqual, 18)] int Age { get; set;} } public class EmployeeValidationRules { public const string EmployeeNameIsRequired = "EmployeeNameIsRequired"; public const string EmployeeIsAdult = "EmployeeIsAdult"; } and using NUnit.Framework; private IObjectSpace objectSpace; [SetUp] public virtual void SetUp() { objectSpace = new XPObjectSpaceProvider(new MemoryDataStoreProvider()).CreateObjectSpace(); XafTypesInfo.Instance.RegisterEntity("Employee", typeof(IEmployee)); XafTypesInfo.Instance.GenerateEntities(); } [Test] public void EmployeeIsValid() { IEmployee employee = objectSpace.CreateObject(); RuleSet ruleSet = new RuleSet(); RuleSetValidationResult result; result = ruleSet.ValidateTarget(objectSpace, employee, DefaultContexts.Save); employee.Name = "Mary Tellitson"; employee.Age = 17; employee.Age = 18; How doe you modify the test setup method to support XF Entities before calling generate entities? |
User | Description | Posted On |