コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: stormsw/spassgen
 public void TestCaseCunkGetObjects()
 {
     Assert.IsInstanceOf <LowAlpha>(Chunk.GetObject <LowAlpha>());
 }