Ejemplo n.º 1
0
        public void WhenIterationsIsZero_ItPasses(
            [Seed] int seed,
            [Size] int size,
            bool isPropertyFallible)
        {
            Action action = () => DevGen
                            .Int32()
                            .ForAll(_ => isPropertyFallible)
                            .Assert(iterations: 0, seed: seed, size: size);

            action.Should().NotThrow();
        }
Ejemplo n.º 2
0
        public void ItCanFailForABooleanProperty(
            [Iterations] int iterations,
            [Seed] int seed,
            [Size] int size)
        {
            Action action = () => DevGen
                            .Int32()
                            .ForAll(_ => false)
                            .Assert(iterations: iterations, seed: seed, size: size);

            action.Should().Throw <GalaxyCheck.Runners.PropertyFailedException>();
        }
Ejemplo n.º 3
0
        public void ItCanPassForABooleanProperty(
            [Iterations] int iterations,
            [Seed] int seed,
            [Size] int size)
        {
            Action action = () => DevGen
                            .Int32()
                            .ForAll(_ => true)
                            .Assert(iterations: iterations, seed: seed, size: size);

            action.Should().NotThrow();
        }
Ejemplo n.º 4
0
        public void ItCanFailForAVoidProperty_NthIteration(
            [Iterations(minIterations: 2)] int iterations,
            [Seed] int seed,
            [Size] int size)
        {
            var iterationCounter = 0;
            var hasFailed        = false;

            Action action = () => DevGen
                            .Int32()
                            .ForAll(_ =>
            {
                iterationCounter++;
                if (iterationCounter >= iterations && !hasFailed)
                {
                    hasFailed = true;
                    Assert.True(false);
                }
            })
                            .Assert(iterations: iterations, seed: seed, size: size);

            action.Should().Throw <GalaxyCheck.Runners.PropertyFailedException>();
        }
Ejemplo n.º 5
0
 public static IGen <Func <T0, T1, T2, T3, TResult> > FunctionOf <T0, T1, T2, T3, TResult>(
     this IGen <TResult> returnGen,
     int?invocationLimit = 1000) =>
 Gen.Function <T0, T1, T2, T3, TResult>(returnGen, invocationLimit);
Ejemplo n.º 6
0
 public static Property <object[]> Nullary(Func <bool> func) => new Property <object[]>(
     Gen.Constant(new object[] { }).Select(x => TestFactory.Create <object[]>(
                                               x,
                                               func,
                                               x)));