-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow xUnit Properties attribute to be used at assembly level (#559)
- Loading branch information
1 parent
017743d
commit 1e0ad9a
Showing
4 changed files
with
104 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
tests/FsCheck.Test/Fscheck.XUnit/PropertyAttributeTests.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
namespace Fscheck.Test.FsCheck.XUnit.PropertyAttribute | ||
open FsCheck.Xunit | ||
open FsCheck | ||
|
||
type AttributeLevel = | ||
| Assembly | ||
| ClassOrModule | ||
| NestedClassOrModule | ||
| MethodOrProperty | ||
|
||
type AttributeLevel_Assembly() = | ||
static member Generator = | ||
Assembly | ||
|> Gen.constant | ||
|> Arb.fromGen | ||
|
||
type AttributeLevel_ClassOrModule() = | ||
static member Generator = | ||
ClassOrModule | ||
|> Gen.constant | ||
|> Arb.fromGen | ||
|
||
type AttributeLevel_MethodOrProperty() = | ||
static member Generator = | ||
MethodOrProperty | ||
|> Gen.constant | ||
|> Arb.fromGen | ||
|
||
type AttributeLevel_NestedClassOrModule() = | ||
static member Generator = | ||
NestedClassOrModule | ||
|> Gen.constant | ||
|> Arb.fromGen | ||
|
||
[<assembly: Properties(Arbitrary = [| typeof<AttributeLevel_Assembly> |])>] | ||
do() | ||
|
||
module ``when module does not have properties attribute``= | ||
[<Property>] | ||
let ``then the assembly attribute should be used`` = function | ||
| Assembly -> true | ||
| _ -> false | ||
|
||
[<Property(Arbitrary = [| typeof<AttributeLevel_MethodOrProperty>|])>] | ||
let ``then the property attribute takes precient`` = function | ||
| MethodOrProperty -> true | ||
| _ -> false | ||
|
||
[<Properties(Arbitrary = [|typeof<AttributeLevel_ClassOrModule>|])>] | ||
module ``when module has properties attribute`` = | ||
|
||
[<Property>] | ||
let ``then the module's property takes precident`` = function | ||
| ClassOrModule -> true | ||
| _ -> false | ||
|
||
[<Property(Arbitrary = [| typeof<AttributeLevel_MethodOrProperty>|])>] | ||
let ``then the property attribute takes precient`` = function | ||
| MethodOrProperty -> true | ||
| _ -> false | ||
|
||
[<Properties(Arbitrary = [|typeof<AttributeLevel_NestedClassOrModule>|])>] | ||
module ``and there is and nested module`` = | ||
[<Property>] | ||
let ``then the nested module's property takes precident`` = function | ||
| NestedClassOrModule -> true | ||
| _ -> false | ||
|
||
|