Skip to content

Commit 53889eb

Browse files
author
Florian Rieger
committed
Implemented InteractorStatusInMemoryGateway.
1 parent 5b358a2 commit 53889eb

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Foundation
2+
3+
class InteractorStatusInMemoryGateway: InteractorStatusGateway {
4+
5+
private var running = false
6+
7+
func isRunning() -> Bool {
8+
return self.running
9+
}
10+
11+
func setRunning(running: Bool) {
12+
self.running = running
13+
}
14+
15+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import XCTest
2+
@testable import ACInteractor
3+
4+
class InteractorStatusInMemoryGatewayTests: XCTestCase {
5+
6+
let gateway = InteractorStatusInMemoryGateway()
7+
8+
// MARK: isRunning()
9+
10+
func testIsRunning_retursFalseByDefault() {
11+
// Act
12+
let running = gateway.isRunning()
13+
14+
// Assert
15+
XCTAssertEqual(running, false)
16+
}
17+
18+
func testIsRunning_afterSettingTrue_returnsTrue() {
19+
// Arrange
20+
gateway.setRunning(true)
21+
22+
// Act
23+
let running = gateway.isRunning()
24+
25+
// Assert
26+
XCTAssertEqual(running, true)
27+
}
28+
29+
func testIsRunning_afterSettingFalse_returnsFalse() {
30+
// Arrange
31+
gateway.setRunning(false)
32+
33+
// Act
34+
let running = gateway.isRunning()
35+
36+
// Assert
37+
XCTAssertEqual(running, false)
38+
}
39+
40+
}

Xcode/ACInteractor.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/* Begin PBXBuildFile section */
1010
17223A171DF9C80000CF7F6F /* InteractorStatusGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17223A161DF9C80000CF7F6F /* InteractorStatusGateway.swift */; };
11+
17223A191DF9CA3E00CF7F6F /* InteractorStatusInMemoryGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17223A181DF9CA3E00CF7F6F /* InteractorStatusInMemoryGateway.swift */; };
12+
17223A1C1DFACC5200CF7F6F /* InteractorStatusInMemoryGatewayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17223A1A1DF9CA7A00CF7F6F /* InteractorStatusInMemoryGatewayTests.swift */; };
1113
173A77271D3842A200FF88BA /* ACInteractor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 173A771C1D3842A200FF88BA /* ACInteractor.framework */; };
1214
173A773B1D3844D400FF88BA /* Interactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 173A77371D3844D400FF88BA /* Interactor.swift */; };
1315
173A773C1D3844D400FF88BA /* InteractorExecuter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 173A77381D3844D400FF88BA /* InteractorExecuter.swift */; };
@@ -34,6 +36,8 @@
3436

3537
/* Begin PBXFileReference section */
3638
17223A161DF9C80000CF7F6F /* InteractorStatusGateway.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InteractorStatusGateway.swift; sourceTree = "<group>"; };
39+
17223A181DF9CA3E00CF7F6F /* InteractorStatusInMemoryGateway.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InteractorStatusInMemoryGateway.swift; sourceTree = "<group>"; };
40+
17223A1A1DF9CA7A00CF7F6F /* InteractorStatusInMemoryGatewayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InteractorStatusInMemoryGatewayTests.swift; sourceTree = "<group>"; };
3741
173A771C1D3842A200FF88BA /* ACInteractor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ACInteractor.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3842
173A77261D3842A200FF88BA /* ACInteractorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ACInteractorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3943
173A77371D3844D400FF88BA /* Interactor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Interactor.swift; sourceTree = "<group>"; };
@@ -98,6 +102,7 @@
98102
17B0BF6F1D3CD057004AA98B /* LazyInteractor.swift */,
99103
1794818E1D57475000CA3590 /* ErrorHandlerExtension.swift */,
100104
17223A161DF9C80000CF7F6F /* InteractorStatusGateway.swift */,
105+
17223A181DF9CA3E00CF7F6F /* InteractorStatusInMemoryGateway.swift */,
101106
);
102107
name = Sources;
103108
path = ../Sources;
@@ -110,6 +115,7 @@
110115
17567E581D3A640000C464BB /* InteractorErrorTests.swift */,
111116
17B0BF711D3CD0A9004AA98B /* LazyInteractorTests.swift */,
112117
179481901D57490900CA3590 /* ErrorHandlerExtensionTests.swift */,
118+
17223A1A1DF9CA7A00CF7F6F /* InteractorStatusInMemoryGatewayTests.swift */,
113119
);
114120
name = Tests;
115121
path = ../Tests;
@@ -233,6 +239,7 @@
233239
buildActionMask = 2147483647;
234240
files = (
235241
173A773B1D3844D400FF88BA /* Interactor.swift in Sources */,
242+
17223A191DF9CA3E00CF7F6F /* InteractorStatusInMemoryGateway.swift in Sources */,
236243
17567E551D3A61C900C464BB /* InteractorError.swift in Sources */,
237244
17223A171DF9C80000CF7F6F /* InteractorStatusGateway.swift in Sources */,
238245
173A773C1D3844D400FF88BA /* InteractorExecuter.swift in Sources */,
@@ -250,6 +257,7 @@
250257
173A77411D38461D00FF88BA /* InteractorExecuterTests.swift in Sources */,
251258
179481921D5749A800CA3590 /* ErrorHandlerExtensionTests.swift in Sources */,
252259
17567E591D3A640000C464BB /* InteractorErrorTests.swift in Sources */,
260+
17223A1C1DFACC5200CF7F6F /* InteractorStatusInMemoryGatewayTests.swift in Sources */,
253261
);
254262
runOnlyForDeploymentPostprocessing = 0;
255263
};

0 commit comments

Comments
 (0)