Last active
June 22, 2020 17:44
-
-
Save itsanan/f5cb6dff4f34dee6ba9354d4c2f593af to your computer and use it in GitHub Desktop.
Testing template for Business Logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
@testable import "DROP YOUR APP TARGET HERE" | |
class Tests: XCTestCase { | |
var sut: "DROP YOUR CLASS THAT YOU WANT TO TEST"! | |
override func setUp() { | |
super.setUp() | |
sut = "DROP YOUR CLASS THAT YOU WANT TO TEST"() | |
} | |
override func tearDown() { | |
sut = nil | |
super.tearDown() | |
} | |
// MARK: - Given | |
func givenSomeProgress() { | |
sut.distance = 10 | |
} | |
// MARK: - Lifecycle | |
func testModel_whenRestarted_distanceIsCleared() { | |
// given | |
givenSomeProgress() | |
// when | |
sut.restart() | |
// then | |
XCTAssertEqual(sut.distance, 0) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated for Swift 5.1 💎