コード例 #1
0
ファイル: AboutAssert.cs プロジェクト: nth-commit/GalaxyCheck
        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();
        }
コード例 #2
0
ファイル: AboutAssert.cs プロジェクト: nth-commit/GalaxyCheck
        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();
        }
コード例 #3
0
ファイル: AboutAssert.cs プロジェクト: nth-commit/GalaxyCheck
        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>();
        }
コード例 #4
0
ファイル: AboutAssert.cs プロジェクト: nth-commit/GalaxyCheck
        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>();
        }