@@ -6,102 +6,102 @@ import XCTest
6
6
7
7
final class ViewControllerTests : XCTestCase {
8
8
func testLazyViewLoading( ) {
9
- let sut = ViewController ( )
9
+ let vc = ViewController ( )
10
10
11
- XCTAssertNil ( sut . viewIfLoaded)
12
- XCTAssertFalse ( sut . isViewLoaded)
11
+ XCTAssertNil ( vc . viewIfLoaded)
12
+ XCTAssertFalse ( vc . isViewLoaded)
13
13
14
- _ = sut . view
14
+ _ = vc . view
15
15
16
- XCTAssertNotNil ( sut . viewIfLoaded)
17
- XCTAssertTrue ( sut . isViewLoaded)
16
+ XCTAssertNotNil ( vc . viewIfLoaded)
17
+ XCTAssertTrue ( vc . isViewLoaded)
18
18
}
19
19
20
20
func testManualViewLoading( ) {
21
- let sut = ViewController ( )
21
+ let vc = ViewController ( )
22
22
23
- XCTAssertNil ( sut . viewIfLoaded)
24
- XCTAssertFalse ( sut . isViewLoaded)
23
+ XCTAssertNil ( vc . viewIfLoaded)
24
+ XCTAssertFalse ( vc . isViewLoaded)
25
25
26
- sut . loadViewIfNeeded ( )
26
+ vc . loadViewIfNeeded ( )
27
27
28
- XCTAssertNotNil ( sut . viewIfLoaded)
29
- XCTAssertTrue ( sut . isViewLoaded)
28
+ XCTAssertNotNil ( vc . viewIfLoaded)
29
+ XCTAssertTrue ( vc . isViewLoaded)
30
30
}
31
31
32
32
func testTitleGetterAndSetter( ) {
33
- let sut = ViewController ( )
33
+ let vc = ViewController ( )
34
34
35
- // XCTAssertNil(sut .title) // This is currently failing, but the initial value of `title` should be `nil`
35
+ // XCTAssertNil(vc .title) // This is currently failing, but the initial value of `title` should be `nil`
36
36
37
- sut . title = " Title "
37
+ vc . title = " Title "
38
38
39
- XCTAssertEqual ( sut . title, " Title " )
39
+ XCTAssertEqual ( vc . title, " Title " )
40
40
}
41
41
42
42
func testValueOfDisablesAutomaticKeyboardDismissal( ) {
43
- let sut = MockViewController ( )
43
+ let vc = MockViewController ( )
44
44
45
- sut . modalPresentationStyleGetter = {
45
+ vc . modalPresentationStyleGetter = {
46
46
return . automatic
47
47
}
48
48
49
- XCTAssertFalse ( sut . disablesAutomaticKeyboardDismissal)
49
+ XCTAssertFalse ( vc . disablesAutomaticKeyboardDismissal)
50
50
51
- sut . modalPresentationStyleGetter = {
51
+ vc . modalPresentationStyleGetter = {
52
52
return . formSheet
53
53
}
54
54
55
- XCTAssertTrue ( sut . disablesAutomaticKeyboardDismissal)
55
+ XCTAssertTrue ( vc . disablesAutomaticKeyboardDismissal)
56
56
}
57
57
58
58
func testNextResponder( ) {
59
59
let expectedResult = View ( frame: . zero)
60
60
61
- let sut = ViewController ( )
61
+ let vc = ViewController ( )
62
62
63
- XCTAssertNil ( sut . next)
63
+ XCTAssertNil ( vc . next)
64
64
65
- expectedResult. addSubview ( sut . view)
65
+ expectedResult. addSubview ( vc . view)
66
66
67
- XCTAssert ( sut . next === expectedResult)
67
+ XCTAssert ( vc . next === expectedResult)
68
68
}
69
69
70
70
func testViewDidLoadMethodCalledAfterLazyViewLoad( ) {
71
- let sut = MockViewController ( )
71
+ let vc = MockViewController ( )
72
72
73
73
let expectation = self . expectation ( description: " viewDidLoad should be called " )
74
74
75
- sut . viewDidLoadBlock = {
75
+ vc . viewDidLoadBlock = {
76
76
expectation. fulfill ( )
77
77
}
78
78
79
- _ = sut . view
79
+ _ = vc . view
80
80
81
81
wait ( for: [ expectation] , timeout: 0.1 )
82
82
}
83
83
84
84
func testViewDidLoadMethodCalledAfterManualViewLoad( ) {
85
- let sut = MockViewController ( )
85
+ let vc = MockViewController ( )
86
86
87
87
let expectation = self . expectation ( description: " viewDidLoad should be called " )
88
88
89
- sut . viewDidLoadBlock = {
89
+ vc . viewDidLoadBlock = {
90
90
expectation. fulfill ( )
91
91
}
92
92
93
- sut . loadViewIfNeeded ( )
93
+ vc . loadViewIfNeeded ( )
94
94
95
95
wait ( for: [ expectation] , timeout: 0.1 )
96
96
}
97
97
98
98
func testViewDidLoadMethodNotCalledIfViewNotLoaded( ) {
99
- let sut = MockViewController ( )
99
+ let vc = MockViewController ( )
100
100
101
101
let expectation = self . expectation ( description: " viewDidLoad should not be called " )
102
102
expectation. isInverted = true
103
103
104
- sut . viewDidLoadBlock = {
104
+ vc . viewDidLoadBlock = {
105
105
expectation. fulfill ( )
106
106
}
107
107
0 commit comments