示例#1
0
 public int Build(IFuzz fuzzy)
 {
     if (fuzzy == null)
     {
         throw new ArgumentNullException(nameof(fuzzy));
     }
     return(fuzzy.Int32().Between(Minimum(), Maximum()));
 }
示例#2
0
 public FuzzyRange(IFuzz fuzz, T minimum, T maximum) : base(fuzz)
 {
     if (maximum.CompareTo(minimum) < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(maximum), $"{maximum} is less than the {nameof(minimum)} value {minimum}");
     }
     this.maximum = maximum;
     this.minimum = minimum;
 }
示例#3
0
        protected override void Given()
        {
            barMock  = MockRepository.GenerateMock <IBar>();
            fuzzMock = MockRepository.GenerateMock <IFuzz>();

            UnderTest = new Foo(barMock, fuzzMock);

            barMock.Stub(x => x.BarFunction()).Return(1);
        }
示例#4
0
        public static Age GenerateAVerySpecificAge(this IFuzz fuzzer)
        {
            // Here, we can have access to all the existing methods
            // exposed by the IFuzz interface
            int years = fuzzer.GeneratePositiveInteger(97);

            // or this one (very useful)
            bool isConfidential = fuzzer.HeadsOrTails();

            // For very specific needs, you have to use the
            // Random property of the Fuzzer
            double aDoubleForInstance = fuzzer.Random.NextDouble();

            return(new Age(years, isConfidential));
        }
示例#5
0
 public FuzzyChar(IFuzz fuzzy) : base(fuzzy, char.MinValue, char.MaxValue)
 {
 }
示例#6
0
 public static T[] Array <T>(this IFuzz fuzzy, Func <T> createElement, Length?length = default) =>
 new FuzzyArray <T>(fuzzy, createElement, length ?? new Length());
示例#7
0
 public FuzzyUInt64(IFuzz fuzzy) : base(fuzzy, ulong.MinValue, ulong.MaxValue)
 {
 }
示例#8
0
 public static string String(this IFuzz fuzzy, Length length) => new FuzzyString(fuzzy, length ?? throw new ArgumentNullException(nameof(length)), null);
示例#9
0
 public static float Single(this IFuzz fuzzy) => new FuzzySingle(fuzzy);
示例#10
0
 public static long Int64(this IFuzz fuzzy) => new FuzzyInt64(fuzzy);
示例#11
0
 public static char Char(this IFuzz fuzzy) => new FuzzyChar(fuzzy);
示例#12
0
 public static byte Byte(this IFuzz fuzzy) => new FuzzyByte(fuzzy);
示例#13
0
 /// <summary>
 /// Instantiates a <see cref="NumberFuzzer"/>.
 /// </summary>
 /// <param name="fuzzer">Instance of <see cref="IFuzz"/> to use.</param>
 public NumberFuzzer(IFuzz fuzzer)
 {
     _fuzzer = fuzzer;
 }
示例#14
0
 public static List <T> List <T>(this IFuzz fuzzy, Func <T> createElement, Count?count = default) =>
 new FuzzyList <T>(fuzzy, createElement, count ?? new Count());
示例#15
0
 public static List <T> List <T>(this IFuzz fuzzy, IEnumerable <T> elements, Count?count = default) =>
 fuzzy.List(() => fuzzy.Element(elements), count);
示例#16
0
 public static short Int16(this IFuzz fuzzy) => new FuzzyInt16(fuzzy);
示例#17
0
 public static int Int32(this IFuzz fuzzy) => new FuzzyInt32(fuzzy);
示例#18
0
 public static DateTime DateTime(this IFuzz fuzzy) => new FuzzyDateTime(fuzzy);
示例#19
0
 public static sbyte SByte(this IFuzz fuzzy) => new FuzzySByte(fuzzy);
示例#20
0
 public static DateTime DateTime(this IFuzz fuzzy, DateTimeKind kind) => new FuzzyDateTime(fuzzy, kind);
示例#21
0
 public static string String(this IFuzz fuzzy) => new FuzzyString(fuzzy);
示例#22
0
 public static DateTimeOffset DateTimeOffset(this IFuzz fuzzy) => new FuzzyDateTimeOffset(fuzzy);
示例#23
0
 public static bool Boolean(this IFuzz fuzzy) => new FuzzyBoolean(fuzzy);
示例#24
0
 public static double Double(this IFuzz fuzzy) => new FuzzyDouble(fuzzy);
示例#25
0
 public static T[] Array <T>(this IFuzz fuzzy, IEnumerable <T> elements, Length?length = default) =>
 fuzzy.Array(() => fuzzy.Element(elements), length);
示例#26
0
 public static T Element <T>(this IFuzz fuzzy, IEnumerable <T> candidates) => new FuzzyElement <T>(fuzzy, candidates);
示例#27
0
 public FuzzyByte(IFuzz fuzzy) : base(fuzzy, byte.MinValue, byte.MaxValue)
 {
 }
示例#28
0
 public static T Enum <T>(this IFuzz fuzzy) where T : Enum => new FuzzyEnum <T>(fuzzy);
示例#29
0
        const short maxExponent = 971 + 1;          // +1 to allow positive and negative infinity

        public FuzzyDouble(IFuzz fuzzy) : base(fuzzy)
        {
        }
示例#30
0
 public static int Index <T>(this IFuzz fuzzy, IEnumerable <T> elements) => new FuzzyIndex <T>(fuzzy, elements);