-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #845 from polyadic/package-metadata
- Loading branch information
Showing
14 changed files
with
1,091 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 @@ | ||
Analyzers and code fixes that guide you towards idiomatic usage of [Funcky]. | ||
|
||
```xml | ||
<PackageReference Include="Funcky.Analyzers" Version="..." PrivateAssets="all" /> | ||
``` | ||
|
||
[Funcky]: https://www.nuget.org/packages/Funcky |
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,14 @@ | ||
## About | ||
Provides async counterparts for [Funcky]'s `IEnumerable` extensions, | ||
`IEnumerable` generators, traversal and retrying. | ||
|
||
## Main Types | ||
* `Funcky.AsyncSequence`—Generate asynchronous sequences. | ||
* `Funcky.Extensions.AsyncEnumerableExtensions`—Extensions for `IAsyncEnumerable`. | ||
* `Funcky.AsyncFunctional`—Async Retrying. | ||
|
||
## Feedback & Contributing | ||
This package is released as open source under the MIT or Apache-2.0 license at your choice. | ||
Bug reports and contributions are welcome at the [GitHub repository](https://github.com/polyadic/funcky). | ||
|
||
[Funcky]: https://www.nuget.org/packages/Funcky |
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,70 @@ | ||
## About | ||
Provides expressive assertions for xUnit.net 3.x that unpack [Funcky]'s monads. | ||
|
||
It also enables `Option`, `Either` and `Unit` for use in theory data by providing | ||
custom [serializers]. | ||
|
||
## Main Types | ||
* `Funcky.FunctionalAssert`—Assertions for Funcky's monads. | ||
|
||
## How to Use | ||
|
||
### Test an Option | ||
```csharp | ||
var some = Option.Some("hello world"); | ||
var none = Option<int>.None; | ||
|
||
// Asserts that an Option contains a value, returns its value. | ||
var text = FunctionalAssert.Some(some); | ||
Assert.Equal("hello world", text); | ||
|
||
// Asserts that an Option contains the given value. | ||
FunctionalAssert.Some("hello world", some); | ||
|
||
// Asserts that the Option is empty. | ||
FunctionalAssert.None(none); | ||
``` | ||
|
||
### Test an Either | ||
```csharp | ||
var right = Either<string>.Return(42); | ||
var left = Either<string, int>.Left("failure"); | ||
|
||
// Asserts that the Either is a right, returns the value. | ||
var value = FunctionalAssert.Right(right); | ||
Assert.Equal(42, value); | ||
|
||
// Asserts that the Either is a right with the given value. | ||
FunctionalAssert.Right(42, right); | ||
|
||
// Asserts that the Either is a left, returns the value. | ||
var message = FunctionalAssert.Left(left); | ||
Assert.Equal("failure", message); | ||
|
||
// Asserts that the Either is a left with the given value. | ||
FunctionalAssert.Left("failure", left); | ||
``` | ||
|
||
## Use an Option as theory data | ||
|
||
```csharp | ||
[Theory] | ||
[MemberData(nameof(OptionValues))] | ||
public void Example(Option<int> option) { /* ... */ } | ||
|
||
public static TheoryData<Option<int>> OptionValues() | ||
=> [ | ||
Option<int>.None, | ||
Option.Some(10), | ||
Option.Some(20), | ||
]; | ||
``` | ||
|
||
## Feedback & Contributing | ||
This package is released as open source under the MIT or Apache-2.0 license at your choice. | ||
Bug reports and contributions are welcome at the [GitHub repository]. | ||
|
||
|
||
[Funcky]: https://www.nuget.org/packages/Funcky | ||
[serializers]: https://xunit.net/docs/getting-started/v3/custom-serialization | ||
[GitHub repository]: https://github.com/polyadic/funcky |
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,60 @@ | ||
## About | ||
Provides expressive assertions for xUnit.net 2.x that unpack [Funcky]'s monads. | ||
|
||
## Main Types | ||
* `Funcky.FunctionalAssert`—Assertions for Funcky's monads. | ||
* `Funcky.Extensions.ToTheoryDataExtension`—Conveniently convert `IEnumerable`s to `TheoryData<..>`. | ||
|
||
## How to Use | ||
|
||
### Test an Option | ||
```csharp | ||
var some = Option.Some("hello world"); | ||
var none = Option<int>.None; | ||
|
||
// Asserts that an Option contains a value, returns its value. | ||
var text = FunctionalAssert.Some(some); | ||
Assert.Equal("hello world", text); | ||
|
||
// Asserts that an Option contains the given value. | ||
FunctionalAssert.Some("hello world", some); | ||
|
||
// Asserts that the Option is empty. | ||
FunctionalAssert.None(none); | ||
``` | ||
|
||
### Test an Either | ||
```csharp | ||
var right = Either<string>.Return(42); | ||
var left = Either<string, int>.Left("failure"); | ||
|
||
// Asserts that the Either is a right, returns the value. | ||
var value = FunctionalAssert.Right(right); | ||
Assert.Equal(42, value); | ||
|
||
// Asserts that the Either is a right with the given value. | ||
FunctionalAssert.Right(42, right); | ||
|
||
// Asserts that the Either is a left, returns the value. | ||
var message = FunctionalAssert.Left(left); | ||
Assert.Equal("failure", message); | ||
|
||
// Asserts that the Either is a left with the given value. | ||
FunctionalAssert.Left("failure", left); | ||
``` | ||
|
||
### Create theory data from an `IEnumerable` | ||
|
||
```csharp | ||
public static TheoryData<string, int> Integers() | ||
=> Enumerable.Range(0, 10) | ||
.Select(n => (n.ToString(), n)) | ||
.ToTheoryData(); | ||
``` | ||
|
||
## Feedback & Contributing | ||
This package is released as open source under the MIT or Apache-2.0 license at your choice. | ||
Bug reports and contributions are welcome at the [GitHub repository]. | ||
|
||
[Funcky]: https://www.nuget.org/packages/Funcky | ||
[GitHub repository]: https://github.com/polyadic/funcky |
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