Created
January 22, 2020 07:23
-
-
Save GeekTree0101/64827d733b210c6ec09f42d813d84332 to your computer and use it in GitHub Desktop.
상태 검증 vs 행위 검증
This file contains 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
class Object { | |
var isEnabled: Bool = false | |
func test() { | |
isEnabled = true | |
} | |
} | |
class SpyObject: Object { | |
var testCalled: Int = 0 | |
override func test() { | |
super.test() | |
testCalled += 1 | |
} | |
} | |
// 상태 검증 | |
let sut = SpyObject() | |
sut.test() | |
assert(sut.isEnabled, true) | |
// 행위 검증 | |
let sut = SpyObject() | |
sut.test() | |
assert(sut.testCalled, 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍