-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Guy Fankam
committed
Jul 22, 2024
1 parent
27d489d
commit 3715a59
Showing
98 changed files
with
9,212 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using CsCheck; | ||
using LanguageExt; | ||
using System.Collections.Frozen; | ||
using System.Linq; | ||
|
||
namespace common.tests; | ||
|
||
public sealed record WorkspaceModel | ||
{ | ||
public required WorkspaceName Name { get; init; } | ||
public required string DisplayName { get; init; } | ||
public Option<string> Description { get; init; } | ||
|
||
public static Gen<WorkspaceModel> Generate() => | ||
from name in GenerateName() | ||
from displayName in GenerateDisplayName() | ||
from description in GenerateDescription().OptionOf() | ||
select new WorkspaceModel | ||
{ | ||
Name = name, | ||
DisplayName = displayName, | ||
Description = description | ||
}; | ||
|
||
public static Gen<WorkspaceName> GenerateName() => | ||
from name in Generator.AlphaNumericStringBetween(10, 20) | ||
select WorkspaceName.From(name); | ||
|
||
public static Gen<string> GenerateDisplayName() => | ||
Generator.AlphaNumericStringBetween(10, 20); | ||
|
||
public static Gen<string> GenerateDescription() => | ||
from lorem in Generator.Lorem | ||
select lorem.Paragraph(); | ||
|
||
public static Gen<FrozenSet<WorkspaceModel>> GenerateSet() => | ||
Generate().FrozenSetOf(x => x.Name, 0, 10) | ||
.DistinctBy(x => x.DisplayName); | ||
} |
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
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
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
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
Oops, something went wrong.