Exemple #1
0
 public int Build(IFuzz fuzzy)
 {
     if (fuzzy == null)
     {
         throw new ArgumentNullException(nameof(fuzzy));
     }
     return(fuzzy.Int32().Between(Minimum(), Maximum()));
 }
Exemple #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;
 }
Exemple #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);
        }
Exemple #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));
        }
Exemple #5
0
 public FuzzyChar(IFuzz fuzzy) : base(fuzzy, char.MinValue, char.MaxValue)
 {
 }
 public static T[] Array <T>(this IFuzz fuzzy, Func <T> createElement, Length?length = default) =>
 new FuzzyArray <T>(fuzzy, createElement, length ?? new Length());
Exemple #7
0
 public FuzzyUInt64(IFuzz fuzzy) : base(fuzzy, ulong.MinValue, ulong.MaxValue)
 {
 }
Exemple #8
0
 public static string String(this IFuzz fuzzy, Length length) => new FuzzyString(fuzzy, length ?? throw new ArgumentNullException(nameof(length)), null);
Exemple #9
0
 public static float Single(this IFuzz fuzzy) => new FuzzySingle(fuzzy);
Exemple #10
0
 public static long Int64(this IFuzz fuzzy) => new FuzzyInt64(fuzzy);
Exemple #11
0
 public static char Char(this IFuzz fuzzy) => new FuzzyChar(fuzzy);
Exemple #12
0
 public static byte Byte(this IFuzz fuzzy) => new FuzzyByte(fuzzy);
Exemple #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;
 }
Exemple #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());
Exemple #15
0
 public static List <T> List <T>(this IFuzz fuzzy, IEnumerable <T> elements, Count?count = default) =>
 fuzzy.List(() => fuzzy.Element(elements), count);
Exemple #16
0
 public static short Int16(this IFuzz fuzzy) => new FuzzyInt16(fuzzy);
Exemple #17
0
 public static int Int32(this IFuzz fuzzy) => new FuzzyInt32(fuzzy);
Exemple #18
0
 public static DateTime DateTime(this IFuzz fuzzy) => new FuzzyDateTime(fuzzy);
Exemple #19
0
 public static sbyte SByte(this IFuzz fuzzy) => new FuzzySByte(fuzzy);
Exemple #20
0
 public static DateTime DateTime(this IFuzz fuzzy, DateTimeKind kind) => new FuzzyDateTime(fuzzy, kind);
Exemple #21
0
 public static string String(this IFuzz fuzzy) => new FuzzyString(fuzzy);
Exemple #22
0
 public static DateTimeOffset DateTimeOffset(this IFuzz fuzzy) => new FuzzyDateTimeOffset(fuzzy);
Exemple #23
0
 public static bool Boolean(this IFuzz fuzzy) => new FuzzyBoolean(fuzzy);
Exemple #24
0
 public static double Double(this IFuzz fuzzy) => new FuzzyDouble(fuzzy);
 public static T[] Array <T>(this IFuzz fuzzy, IEnumerable <T> elements, Length?length = default) =>
 fuzzy.Array(() => fuzzy.Element(elements), length);
Exemple #26
0
 public static T Element <T>(this IFuzz fuzzy, IEnumerable <T> candidates) => new FuzzyElement <T>(fuzzy, candidates);
Exemple #27
0
 public FuzzyByte(IFuzz fuzzy) : base(fuzzy, byte.MinValue, byte.MaxValue)
 {
 }
Exemple #28
0
 public static T Enum <T>(this IFuzz fuzzy) where T : Enum => new FuzzyEnum <T>(fuzzy);
Exemple #29
0
        const short maxExponent = 971 + 1;          // +1 to allow positive and negative infinity

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