You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,8 @@ sequenceDiagram
32
32
```
33
33
34
34
## Test 🧪
35
+
36
+
using `F#`
35
37
36
38
```fsharp
37
39
open ApiStub.FSharp.CE
@@ -42,7 +44,7 @@ open Xunit
42
44
module Tests =
43
45
44
46
// build your aspnetcore integration testing CE
45
-
let test = new TestClient<Startup>()
47
+
let test = new TestClient<Program>()
46
48
47
49
[<Fact>]
48
50
let ``Calls Hello and returns OK`` () =
@@ -58,9 +60,31 @@ module Tests =
58
60
59
61
let! r = client.GetAsync("/Hello")
60
62
63
+
// rest of your tests...
64
+
61
65
}
62
66
```
63
67
68
+
or in `C#` if you prefer
69
+
70
+
```csharp
71
+
usingApiStub.FSharp;
72
+
usingstaticApiStub.Fsharp.CsharpExtensions;
73
+
74
+
asyncTaskCallsHelloAndReturnsOk () {
75
+
76
+
varclient=
77
+
newCE.TestClient<Web.Sample.Program>()
78
+
.GETJ("/externalApi", new { Ok="Yeah" })
79
+
.GetFactory()
80
+
.CreateClient();
81
+
82
+
varr=awaitclient.GetAsync("/Hello");
83
+
84
+
// rest of your tests...
85
+
86
+
```
87
+
64
88
### Test .NET C# 🤝 from F#
65
89
66
90
F# isagreatlanguage, butitdoesn't have to be scary to try it. Integration and Unit tests are a great way to introduce F# to your team if you are already using .NET or ASPNETCORE.
0 commit comments