public void RuleDecoratorExecuted() { var e = new RuleInitializerEntity(); e.Extensions.InitializeRules(); RuleInitializerEntity.DecoratorExecuted.ShouldBeTrue(); }
public void PropertiesTest() { var e = new RuleInitializerEntity(); e.Extensions.DynamicProperties["abc"] = 5; e.Extensions.DynamicProperties["x"] = 5; RuleInitializerEntity.PropertiesExecuted.ShouldBeTrue(); }
public void RangeAttributeTest() { var e = new RuleInitializerEntity(); e.Extensions.InitializeRules(); e.Value2 = 33; e.Value3 = 34; e.Extensions.BrokenRules.Count.ShouldEqual(2); }
public void AttributeRules() { var e = new RuleInitializerEntity(); e.Extensions.InitializeRules(); e.Email = "a"; e.Extensions.BrokenRules.ShouldContains("Email", 1); e.Email = "*****@*****.**"; e.Extensions.BrokenRules.ShouldContains("Email", 0); }
public void CompareTest() { var e = new RuleInitializerEntity(); e.Extensions.InitializeRules(); e.Password = "******"; //e.Extensions.Validate(); e.Extensions.BrokenRules.Count.ShouldEqual(1); }
public void CollectionIsValid() { var entity = new Entity(); entity.Extensions.CreateValidationRule(en => en.Number == 0).Start(); var e = new RuleInitializerEntity {Entities2 = {entity}}; e.Extensions.IsValid.ShouldBeTrue(); entity.Number = 4; e.Extensions.IsValid.ShouldBeFalse(); }
public void RecursiveValidation() { var entity = new Entity(); entity.Extensions.CreateValidationRule(en => en.Number == 0).Start(); var e = new RuleInitializerEntity{Entity = entity}; e.Extensions.Validate().ShouldBeTrue(); entity.Number = 4; e.Extensions.Validate().ShouldBeFalse(); }
public void RuleInit2Executed() { try { var e = new RuleInitializerEntity(); var c = new Child(); c.Parent = e; e.Child = c; e.Extensions.InitializeRules(); e.Inited.ShouldBeTrue(); } catch (StackOverflowException e) { Console.WriteLine(e); } }