forked from thomhurst/TUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassConstructorWithEnumerableTest.vb
More file actions
41 lines (34 loc) · 1.15 KB
/
ClassConstructorWithEnumerableTest.vb
File metadata and controls
41 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Imports System
Imports Microsoft.Extensions.DependencyInjection
Imports TUnit
Imports TUnit.Core
<ClassConstructor(GetType(DependencyInjectionClassConstructor))>
<NotInParallel>
Public NotInheritable Class ClassConstructorWithEnumerableTest
Implements IDisposable
Private _isDisposed As Boolean
Private ReadOnly _dummy As DummyReferenceTypeClass
Public Sub New(dummy As DummyReferenceTypeClass)
Me._dummy = dummy
End Sub
<Before(HookType.Test)>
Public Sub Setup()
If _isDisposed Then
Throw New ObjectDisposedException(NameOf(ClassConstructorWithEnumerableTest))
End If
End Sub
<Test>
<MethodDataSource(NameOf(GetValues))>
Public Sub DoSomething(value As Integer)
' Just use the dummy object that was injected
If _dummy Is Nothing Then
Throw New InvalidOperationException("Dummy object was not injected")
End If
End Sub
Public Shared Function GetValues() As IEnumerable(Of Integer)
Return New Integer() {1, 2, 3, 4}
End Function
Public Sub Dispose() Implements IDisposable.Dispose
_isDisposed = True
End Sub
End Class