Return Value
A new Mockable
that will be able to create stubs for the subcript.
MockableSubscript.Writable
for a subcript.Framework
func mockable<ReturnType>(_ parameters: ParameterType ..., function: String = #function, file: StaticString = #file, line: UInt = #line) -> MockableSubscript .Writable<ReturnType >
A new Mockable
that will be able to create stubs for the subcript.
function
Function concerned by the Mockable
.
file
The file name where the method is called.
line
The line where the method is called.
You must use it during the extension of Given
.
protocol CustomType {
subscript(parameter1: String, parameter2: Int) -> Int { get set }
}
extension Given where WrappedType == CustomType {
subscript(parameter1: String, parameter2: Int) -> MockableSubscript.Writable<Int> {
mockable(parameter1, parameter2)
}
}