hedgehogqa / hedgehogqa/fsharp-hedgehog

Add csharp complex generator example

Open
#359 3 comments 0 reactions 0 assignees View on GitHub
good first issue help wanted
Dominant language
F#
Stars
284
Forks
31
PR merge metrics
No merged PRs in 30d

Description

In tutorial we have sample for genarator of IpAddress

```fsharp
open System.Net
let ipAddressGen : Gen = gen {
let! addr = Range.constantBounded () |> Gen.byte |> Gen.array (Range.singleton 4)
return System.Net.IPAddress addr
}
```

Anybody could check my translation to csharp? It is'nt idiomatic csharp IMHO

```csharp
var byteRange = Range.ConstantBoundedByte();
var byteGen = Gen.Byte(byteRange);
var byteArrayGen = Hedgehog.Gen.array(Range.FromValue(4), byteGen);
var ipAddressGen = byteArrayGen.Select(bytes => new IPAddress(bytes));
```

May be it's suitable to add csharp.md with more examples?
Right now I try get how to use `Property.CounterExample`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.