/// <summary> /// Adds the conditional. /// </summary> /// <returns>The conditional.</returns> /// <param name="condition">If set to <c>true</c> condition.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public PasswordBuilder AddConditional <T>(bool condition) where T : Chunk, new() { if (condition) { this.proto.AddRule(Chunk.GetObject <T>()); // oer (T)Activator.CreateInstance(typeof(T))); } return(this); }
/// <summary> /// Adds the conditional. /// </summary> /// <returns>Self for fluent syntax support</returns> /// <param name="condition">If set to <c>true</c> condition.</param> /// <param name="min">Minimum.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public PasswordBuilder AddConditional <T>(bool condition, int min) where T : Chunk, new() { if (condition) { var result = Chunk.GetObject <T>(); result.Min = min; this.proto.AddRule(result); } return(this); }
public void TestCaseCunkGetObjects() { Assert.IsInstanceOf <LowAlpha>(Chunk.GetObject <LowAlpha>()); }