public void CanHaveRuleOnLazyField() { var context = GetContext(); context.Assert.Try(() => { var root = new HasLazyField(); root.CheckRules(); string broken; var rootEI = (IDataErrorInfo)root; broken = rootEI[HasLazyField.Value1Property.Name]; context.Assert.AreEqual("PrimaryProperty does not exist.", broken); var value = root.Value1; // intializes field root.CheckRules(); broken = rootEI[HasLazyField.Value1Property.Name]; context.Assert.AreEqual("PrimaryProperty has value.", broken); context.Assert.Success(); }); context.Complete(); }
public void CanHaveRuleOnLazyField() { var context = GetContext(); context.Assert.Try(() => { var root = new HasLazyField(); root.CheckRules(); string broken; #if SILVERLIGHT var rootEI = (INotifyDataErrorInfo)root; broken = rootEI.GetErrors(HasLazyField.Value1Property.Name).OfType <Csla.Rules.BrokenRule>().First().Description; #else var rootEI = (IDataErrorInfo)root; broken = rootEI[HasLazyField.Value1Property.Name]; #endif context.Assert.AreEqual("PrimaryProperty does not exist.", broken); var value = root.Value1; // intializes field root.CheckRules(); #if SILVERLIGHT broken = rootEI.GetErrors(HasLazyField.Value1Property.Name).OfType <Csla.Rules.BrokenRule>().First().Description; #else broken = rootEI[HasLazyField.Value1Property.Name]; #endif context.Assert.AreEqual("PrimaryProperty has value.", broken); context.Assert.Success(); }); context.Complete(); }