示例#1
0
文件: Money.cs 项目: ariasemis/monies
        public static Arbitrary <Money <T> > Get <T>() where T : IEquatable <T>
        {
            var gen = from money in MoneyGenerators.Generator <T>()
                      where money != null
                      select money;

            return(Arb.From(gen, MoneyGenerators.Shrinker));
        }
示例#2
0
        private static IEnumerable <SameCurrency <T> > Shrinker <T>(SameCurrency <T> x) where T : IEquatable <T>
        {
            if (x == null)
            {
                yield break;
            }

            using (var first = MoneyGenerators.Shrinker(x.First).GetEnumerator())
                using (var second = MoneyGenerators.Shrinker(x.Second).GetEnumerator())
                    using (var third = MoneyGenerators.Shrinker(x.Third).GetEnumerator())
                    {
                        while (first.MoveNext() &&
                               second.MoveNext() &&
                               third.MoveNext())
                        {
                            yield return(new SameCurrency <T>(
                                             first.Current,
                                             second.Current,
                                             third.Current));
                        }
                    }
        }
示例#3
0
文件: Money.cs 项目: ariasemis/monies
 public static Arbitrary <Money <T> > Get <T>() where T : IEquatable <T>
 => Arb.From(MoneyGenerators.Generator <T>(), MoneyGenerators.Shrinker);