Skip to content

Instantly share code, notes, and snippets.

@GeekTree0101
Created January 22, 2020 07:23
Show Gist options
  • Save GeekTree0101/64827d733b210c6ec09f42d813d84332 to your computer and use it in GitHub Desktop.
Save GeekTree0101/64827d733b210c6ec09f42d813d84332 to your computer and use it in GitHub Desktop.
상태 검증 vs 행위 검증
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)
@magi82
Copy link

magi82 commented Jan 22, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment