Exemple #1
0
        public void OptionCountWhenSome()
        {
            Option <int> optionValue = 35;
            int          result      = OptionModule.Count(optionValue);

            Assert.AreEqual(1, result);
        }
Exemple #2
0
        public void OptionCountWhenNone()
        {
            Option <int> optionValue = Option <int> .None();

            int result = OptionModule.Count(optionValue);

            Assert.AreEqual(0, result);
        }
Exemple #3
0
 /// <summary>
 /// Evaluates a <see cref="Option{T}.Match{TResult}(Func{T, TResult}, Func{TResult})"/> that returns one when <see cref="Option{T}.IsSome"/>, otherwise returns 0
 /// </summary>
 /// <typeparam name="T">The type of the option value.</typeparam>
 /// <param name="option">The input option.</param>
 /// <returns>Returns one if the option <see cref="Option{T}.IsSome"/>, otherwise returns zero.</returns>
 public static int Count <T>(this Option <T> option)
 => OptionModule.Count(option);