File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1111 <Compile Include =" AssemblyInfo.fs" />
1212 <Compile Include =" Nunit.Extensions.fs" />
1313 <Compile Include =" TestUtils.fs" />
14+ <Compile Include =" TaskSeq.AllTests.fs" />
1415 <Compile Include =" TaskSeq.Choose.Tests.fs" />
1516 <Compile Include =" TaskSeq.Collect.Tests.fs" />
1617 <Compile Include =" TaskSeq.Filter.Tests.fs" />
Original file line number Diff line number Diff line change 1+ namespace FSharpy.Tests
2+
3+ open System
4+ open System.Threading .Tasks
5+ open System.Reflection
6+
7+ open Xunit
8+ open FsUnit.Xunit
9+ open FsToolkit.ErrorHandling
10+
11+ open FSharpy
12+ open Xunit.Abstractions
13+
14+
15+ type AllTests ( output : ITestOutputHelper ) =
16+
17+ [<Fact>]
18+ let ``Run all tests`` () =
19+ let myAsm = Assembly.GetExecutingAssembly()
20+
21+ let allMethods = [
22+ for ty in myAsm.DefinedTypes do
23+ for mem in ty.DeclaredMembers do
24+ match mem.MemberType with
25+ | MemberTypes.Method ->
26+ if mem.Name.StartsWith( " TaskSeq" ) || mem.Name.StartsWith( " CE" ) then
27+ yield ty, mem :?> MethodInfo
28+ | _ -> ()
29+ ]
30+
31+ let x =
32+ { new System.IFormattable with
33+ member x.ToString ( format : string , provider : System.IFormatProvider ) =
34+ if format = " D" then " foo" else " bar"
35+ }
36+
37+ task {
38+ for ( ty, method) in allMethods do
39+ let ctor = ty.GetConstructor [| typeof< ITestOutputHelper> |]
40+
41+ if isNull ctor then
42+ failwith " Constructor for test not found"
43+
44+ let testObj = ctor.Invoke([| output |])
45+
46+ let! _ =
47+ if method.ReturnType.Name.Contains " Task" then
48+ method.Invoke( testObj, null ) :?> Task < unit >
49+ else
50+ method.Invoke( testObj, null ) |> ignore
51+ task { return () }
52+
53+ ()
54+
55+ return ()
56+ }
You can’t perform that action at this time.
0 commit comments