@@ -59,39 +59,42 @@ module XunitHelpers =
59
59
Invoke = fun ( o : obj ) -> invoke o m })
60
60
61
61
let TestToFuchu ( attr : TestAttributes ) ( testCategory : Type -> string ) ( testType : Type ) ( testMethods : TestMethod seq ) =
62
- let methods = nonIgnoredMethods attr.Ignore testType
63
- let methodsWithAttrs = methodsWithAttrs methods
64
- let setupMethods = methodsWithAttrs [ attr.Setup]
65
- let teardownMethods = methodsWithAttrs [ attr.TearDown]
66
- let fixtureSetupMethods = methodsWithAttrs [ attr.FixtureSetup]
62
+ if testType.IsAbstract
63
+ then TestList []
64
+ else
65
+ let methods = nonIgnoredMethods attr.Ignore testType
66
+ let methodsWithAttrs = methodsWithAttrs methods
67
+ let setupMethods = methodsWithAttrs [ attr.Setup]
68
+ let teardownMethods = methodsWithAttrs [ attr.TearDown]
69
+ let fixtureSetupMethods = methodsWithAttrs [ attr.FixtureSetup]
67
70
68
- TestList <| seq {
69
- if Seq.length testMethods > 0 then
70
- yield testList ( testType.FullName + testCategory testType) <| seq {
71
- let testInstance = create testType
72
- let inline invoke metod = invoke testInstance metod
73
- Seq.iter invoke fixtureSetupMethods
74
- for tm in testMethods ->
75
- test tm.Name {
76
- try
77
- Seq.iter invoke setupMethods
78
- try
79
- tm.Invoke testInstance
80
- match tm.ExpectedException with
81
- | Some expectedExc ->
82
- failtestf " Expected exception '%s ' but no exception was thrown" expectedExc
83
- | None -> ()
84
- with
85
- | : ? TargetInvocationException as e ->
86
- match tm.ExpectedException with
87
- | Some expectedExc ->
88
- let innerExc = e.InnerException.GetType() .AssemblyQualifiedName
89
- if expectedExc <> innerExc
90
- then failtestf " Expected exception '%s ', got '%s '" expectedExc innerExc
91
- | None ->
92
- raise e.InnerException
93
- finally
94
- Seq.iter invoke teardownMethods
71
+ TestList <| seq {
72
+ if Seq.length testMethods > 0 then
73
+ yield testList ( testType.FullName + testCategory testType) <| seq {
74
+ let testInstance = create testType
75
+ let inline invoke metod = invoke testInstance metod
76
+ Seq.iter invoke fixtureSetupMethods
77
+ for tm in testMethods ->
78
+ test tm.Name {
79
+ try
80
+ Seq.iter invoke setupMethods
81
+ try
82
+ tm.Invoke testInstance
83
+ match tm.ExpectedException with
84
+ | Some expectedExc ->
85
+ failtestf " Expected exception '%s ' but no exception was thrown" expectedExc
86
+ | None -> ()
87
+ with
88
+ | : ? TargetInvocationException as e ->
89
+ match tm.ExpectedException with
90
+ | Some expectedExc ->
91
+ let innerExc = e.InnerException.GetType() .AssemblyQualifiedName
92
+ if expectedExc <> innerExc
93
+ then failtestf " Expected exception '%s ', got '%s '" expectedExc innerExc
94
+ | None ->
95
+ raise e.InnerException
96
+ finally
97
+ Seq.iter invoke teardownMethods
98
+ }
95
99
}
96
- }
97
100
}
0 commit comments