Skip to content

Migration from 2 to 3 #725

@lloydjatkinson

Description

@lloydjatkinson

I have a test suite currently using FsCheck 2.x with C#. I upgraded to 3.x, and I can't find a migration guide.

Here are some of the errors I have.

The name 'Prop' does not exist in the current context:

        [Property]
        public Property EveryCellCanBeReached() =>
            Prop.ForAll(
                Generators.Grid(),
                Generators.Algorithm(),
                (grid, type) =>
                {
                     //...
                });

Fortunately that one was an easy fix using FsCheck.Fluent; but the rest I do not understand how to fix. I was hoping someone might be able to provide some pointers.


No overload for method 'From' takes 0 arguments. Previously this was used to simply select an arbitrary enum value, but now appears to expect a Gen?

        public static Arbitrary<AlgorithmType> Algorithm() =>
            Arb.From<AlgorithmType>();

        // 'Arb' does not contain a definition for 'Default'
        public static Arbitrary<PositiveInt> PositiveIntGreaterThanOne => Arb.Default.PositiveInt().Filter(x => x.Get > 1);

        public static Gen<PositiveInt> GeneratePositiveIntGreaterThanOne => PositiveIntGreaterThanOne.Generator;

        // 'Arb' does not contain a definition for 'Generate'
        public static Gen<PositiveInt> GeneratePositiveIntGreaterThanOneLessThanTwenty =>
            from value in Arb.Generate<PositiveInt>()
            where value.Get > 1 && value.Get <= 20
            select value;

[Property]
public Property MazesAreGeneratedDeterministically() =>
    Prop.ForAll(
        // 'Arb' does not contain a definition for 'Default'
        Arb.Default.PositiveInt().Filter(x => x.Get > 1),
        Generators.Algorithm(),
        // 'Arb' does not contain a definition for 'Default'
        Arb.Default.Int32().Filter(x => x != 0),
        (size, type, seed) => // ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions