danielsaidi / MockingKit

MockingKit is a Swift SDK that lets you easily mock protocols and classes in `Swift`.
MIT License
87 stars 7 forks source link

Improve support for mocked properties #10

Open danielsaidi opened 4 years ago

danielsaidi commented 4 years ago

This currently doesn't work:

class MockStore: Mock, Store {

    lazy var hasContentRef = MockReference(hasContent) <-- hasContent is not a function
    lazy var deleteContentRef = MockReference(deleteContent)

    // --> Which requires us to do this:
    var hasContentInvokeCount = 0
    var hasContentReturnValue = false
    public var hasContent: Bool {
        hasContentInvokeCount += 1
        return hasContentReturnValue
    }

    public func deleteContent() {
        invoke(deleteContentRef, args: ())
    }
}