public var invokedCreateFile: Bool { invokedCreateFileCount > 0 }
public var invokedCreateFileCount = 0
public var invokedCreateFileParameters: (fileName: String, directory: FileStorage.DirectoryType, object: T?)?
public var invokedCreateFileParametersList: [(fileName: String, directory: FileStorage.DirectoryType, object: T?)] = []
public var stubbedCreateFileResult: Bool!
public var invokedCreateFileExpectation = XCTestExpectation(description: "\(#function) expectation")
@discardableResult
public func createFile<T: Encodable>(fileName: String, in directory: FileStorage.DirectoryType, contents object: T?) -> Bool {
defer { invokedCreateFileExpectation.fulfill() }
invokedCreateFileCount += 1
invokedCreateFileParameters = (fileName: fileName, directory: directory, object: object)
invokedCreateFileParametersList.append((fileName: fileName, directory: directory, object: object))
return stubbedCreateFileResult
}
In the invokedCreateFileParameters and invokedCreateFileParametersList the function parameter object is generated with type T?, this should be Encodable
Function to mock:
Output from generator:
In the
invokedCreateFileParameters
andinvokedCreateFileParametersList
the function parameterobject
is generated with typeT?
, this should beEncodable