/// <summary>
        /// Creates a chain of time zone retrieving.
        /// </summary>
        /// <returns>Chain.</returns>
        protected virtual ChainOfCircumstances <TimeZoneInfo> CreateChain()
        {
            var chain = new ChainOfCircumstances <TimeZoneInfo>();

            chain.AddLast(GetFromServiceCalendar, chain.NotDefault());
            chain.AddLast(GetFromSysSetting);
            return(chain);
        }
        /// <summary>
        /// Creates a chain of time zone retrieving.
        /// </summary>
        /// <returns>Chain.</returns>
        protected override ChainOfCircumstances <TimeZoneInfo> CreateChain()
        {
            var chain = new ChainOfCircumstances <TimeZoneInfo>();

            chain.AddLast(GetFromServiceInServicePact, chain.NotDefault());
            chain.AddLast(GetFromServicePact, chain.NotDefault());
            return(chain + base.CreateChain());
        }
예제 #3
0
        /// <summary>
        /// Concatenates two chains into a new one.
        /// </summary>
        /// <param name="first">First chain.</param>
        /// <param name="second">Second chain.</param>
        /// <returns>Concatenated.</returns>
        public static ChainOfCircumstances <TResult> operator +(
            ChainOfCircumstances <TResult> first,
            ChainOfCircumstances <TResult> second)
        {
            var result = new ChainOfCircumstances <TResult>();

            foreach (var circumstance in first._circumstances)
            {
                result.AddLast(circumstance);
            }
            foreach (var circumstance in second._circumstances)
            {
                result.AddLast(circumstance);
            }
            return(result);
        }
예제 #4
0
 /// <summary>
 /// A common postcondition pointing that the result mustn't be
 /// a default value of <paramref name="TResult"/>.
 /// </summary>
 /// <typeparam name="TResult">Type of result.</typeparam>
 /// <param name="chain">The chain.</param>
 /// <returns>Postcondition.</returns>
 public static Predicate <TResult> NotDefault <TResult>(this ChainOfCircumstances <TResult> chain)
 {
     return(result => !Equals(result, default(TResult)));
 }