Best Mockingbird code snippet using MockingContext.didInvoke
NimbleSurveyMocks.generated.swift
Source:NimbleSurveyMocks.generated.swift
...41 }42 // MARK: Mocked `request`(`method`: HttpMethod, `baseUrl`: String?, `endPoint`: String, `token`: String?, `params`: HttpParametable?)43 public func `request`(`method`: HttpMethod, `baseUrl`: String?, `endPoint`: String, `token`: String?, `params`: HttpParametable?) -> Promise<ApiResponse> {44 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`request`(`method`: HttpMethod, `baseUrl`: String?, `endPoint`: String, `token`: String?, `params`: HttpParametable?) -> Promise<ApiResponse>", arguments: [Mockingbird.ArgumentMatcher(`method`), Mockingbird.ArgumentMatcher(`baseUrl`), Mockingbird.ArgumentMatcher(`endPoint`), Mockingbird.ArgumentMatcher(`token`), Mockingbird.ArgumentMatcher(`params`)])45 mockingContext.didInvoke(invocation)46 let implementation = stubbingContext.implementation(for: invocation, optional: false)47 if let concreteImplementation = implementation as? (HttpMethod, String?, String, String?, HttpParametable?) -> Promise<ApiResponse> {48 return concreteImplementation(`method`, `baseUrl`, `endPoint`, `token`, `params`)49 } else {50 return (implementation as! () -> Promise<ApiResponse>)()51 }52 }53 public func `request`(`method`: @escaping @autoclosure () -> HttpMethod, `baseUrl`: @escaping @autoclosure () -> String?, `endPoint`: @escaping @autoclosure () -> String, `token`: @escaping @autoclosure () -> String?, `params`: @escaping @autoclosure () -> HttpParametable?) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (HttpMethod, String?, String, String?, HttpParametable?) -> Promise<ApiResponse>, Promise<ApiResponse>> {54 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`method`), Mockingbird.resolve(`baseUrl`), Mockingbird.resolve(`endPoint`), Mockingbird.resolve(`token`), Mockingbird.resolve(`params`)]55 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`request`(`method`: HttpMethod, `baseUrl`: String?, `endPoint`: String, `token`: String?, `params`: HttpParametable?) -> Promise<ApiResponse>", arguments: arguments)56 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (HttpMethod, String?, String, String?, HttpParametable?) -> Promise<ApiResponse>, Promise<ApiResponse>>(mock: self, invocation: invocation)57 }58}59/// Create a source-attributed `NimbleSurvey.ApiService` concrete protocol mock instance.60public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.ApiService.Protocol) -> ApiServiceMock {61 return ApiServiceMock(sourceLocation: SourceLocation(file, line))62}63// MARK: - Mocked AuthForgotPasswordVM64public final class AuthForgotPasswordVMMock: NimbleSurvey.AuthForgotPasswordVM, Mockingbird.Mock {65 static let staticMock = Mockingbird.StaticMock()66 public let mockingContext = Mockingbird.MockingContext()67 public let stubbingContext = Mockingbird.StubbingContext()68 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])69 public var sourceLocation: Mockingbird.SourceLocation? {70 get { return stubbingContext.sourceLocation }71 set {72 stubbingContext.sourceLocation = newValue73 AuthForgotPasswordVMMock.staticMock.stubbingContext.sourceLocation = newValue74 }75 }76 // MARK: Mocked isValid77 public var `isValid`: Observable<Bool> {78 get {79 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "isValid.get", arguments: [])80 mockingContext.didInvoke(invocation)81 return (stubbingContext.implementation(for: invocation) as! () -> Observable<Bool>)()82 }83 }84 public func getIsValid() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<Bool>, Observable<Bool>> {85 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "isValid.get", arguments: [])86 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<Bool>, Observable<Bool>>(mock: self, invocation: invocation)87 }88 // MARK: Mocked state89 public var `state`: ValueObservable<NimbleSurvey.AuthForgotPasswordState> {90 get {91 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "state.get", arguments: [])92 mockingContext.didInvoke(invocation)93 return (stubbingContext.implementation(for: invocation) as! () -> ValueObservable<NimbleSurvey.AuthForgotPasswordState>)()94 }95 }96 public func getState() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<NimbleSurvey.AuthForgotPasswordState>, ValueObservable<NimbleSurvey.AuthForgotPasswordState>> {97 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "state.get", arguments: [])98 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<NimbleSurvey.AuthForgotPasswordState>, ValueObservable<NimbleSurvey.AuthForgotPasswordState>>(mock: self, invocation: invocation)99 }100 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {101 Mockingbird.checkVersion(for: self)102 self.sourceLocation = sourceLocation103 }104 // MARK: Mocked `reset`()105 public func `reset`() -> Promise<Void> {106 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`reset`() -> Promise<Void>", arguments: [])107 mockingContext.didInvoke(invocation)108 let implementation = stubbingContext.implementation(for: invocation, optional: false)109 if let concreteImplementation = implementation as? () -> Promise<Void> {110 return concreteImplementation()111 } else {112 return (implementation as! () -> Promise<Void>)()113 }114 }115 public func `reset`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>> {116 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`reset`() -> Promise<Void>", arguments: [])117 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)118 }119 // MARK: Mocked `setEmail`(_ `text`: String?)120 public func `setEmail`(_ `text`: String?) -> Void {121 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setEmail`(_ `text`: String?) -> Void", arguments: [Mockingbird.ArgumentMatcher(`text`)])122 mockingContext.didInvoke(invocation)123 let implementation = stubbingContext.implementation(for: invocation, optional: true)124 if let concreteImplementation = implementation as? (String?) -> Void {125 concreteImplementation(`text`)126 } else {127 (implementation as? () -> Void)?()128 }129 }130 public func `setEmail`(_ `text`: @escaping @autoclosure () -> String?) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (String?) -> Void, Void> {131 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`text`)]132 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setEmail`(_ `text`: String?) -> Void", arguments: arguments)133 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (String?) -> Void, Void>(mock: self, invocation: invocation)134 }135}136/// Create a source-attributed `NimbleSurvey.AuthForgotPasswordVM` concrete protocol mock instance.137public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.AuthForgotPasswordVM.Protocol) -> AuthForgotPasswordVMMock {138 return AuthForgotPasswordVMMock(sourceLocation: SourceLocation(file, line))139}140// MARK: - Mocked AuthService141public final class AuthServiceMock: NimbleSurvey.AuthService, Mockingbird.Mock {142 static let staticMock = Mockingbird.StaticMock()143 public let mockingContext = Mockingbird.MockingContext()144 public let stubbingContext = Mockingbird.StubbingContext()145 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])146 public var sourceLocation: Mockingbird.SourceLocation? {147 get { return stubbingContext.sourceLocation }148 set {149 stubbingContext.sourceLocation = newValue150 AuthServiceMock.staticMock.stubbingContext.sourceLocation = newValue151 }152 }153 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {154 Mockingbird.checkVersion(for: self)155 self.sourceLocation = sourceLocation156 }157 // MARK: Mocked `forgotPassword`(`params`: AuthForgotPasswordParams)158 public func `forgotPassword`(`params`: AuthForgotPasswordParams) -> Promise<Void> {159 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`forgotPassword`(`params`: AuthForgotPasswordParams) -> Promise<Void>", arguments: [Mockingbird.ArgumentMatcher(`params`)])160 mockingContext.didInvoke(invocation)161 let implementation = stubbingContext.implementation(for: invocation, optional: false)162 if let concreteImplementation = implementation as? (AuthForgotPasswordParams) -> Promise<Void> {163 return concreteImplementation(`params`)164 } else {165 return (implementation as! () -> Promise<Void>)()166 }167 }168 public func `forgotPassword`(`params`: @escaping @autoclosure () -> AuthForgotPasswordParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthForgotPasswordParams) -> Promise<Void>, Promise<Void>> {169 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]170 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`forgotPassword`(`params`: AuthForgotPasswordParams) -> Promise<Void>", arguments: arguments)171 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthForgotPasswordParams) -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)172 }173 // MARK: Mocked `login`(`params`: AuthLoginParams)174 public func `login`(`params`: AuthLoginParams) -> Promise<UserTokenInfo> {175 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`login`(`params`: AuthLoginParams) -> Promise<UserTokenInfo>", arguments: [Mockingbird.ArgumentMatcher(`params`)])176 mockingContext.didInvoke(invocation)177 let implementation = stubbingContext.implementation(for: invocation, optional: false)178 if let concreteImplementation = implementation as? (AuthLoginParams) -> Promise<UserTokenInfo> {179 return concreteImplementation(`params`)180 } else {181 return (implementation as! () -> Promise<UserTokenInfo>)()182 }183 }184 public func `login`(`params`: @escaping @autoclosure () -> AuthLoginParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthLoginParams) -> Promise<UserTokenInfo>, Promise<UserTokenInfo>> {185 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]186 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`login`(`params`: AuthLoginParams) -> Promise<UserTokenInfo>", arguments: arguments)187 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthLoginParams) -> Promise<UserTokenInfo>, Promise<UserTokenInfo>>(mock: self, invocation: invocation)188 }189 // MARK: Mocked `logout`(`params`: AuthLogoutParams)190 public func `logout`(`params`: AuthLogoutParams) -> Promise<Void> {191 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`logout`(`params`: AuthLogoutParams) -> Promise<Void>", arguments: [Mockingbird.ArgumentMatcher(`params`)])192 mockingContext.didInvoke(invocation)193 let implementation = stubbingContext.implementation(for: invocation, optional: false)194 if let concreteImplementation = implementation as? (AuthLogoutParams) -> Promise<Void> {195 return concreteImplementation(`params`)196 } else {197 return (implementation as! () -> Promise<Void>)()198 }199 }200 public func `logout`(`params`: @escaping @autoclosure () -> AuthLogoutParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthLogoutParams) -> Promise<Void>, Promise<Void>> {201 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]202 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`logout`(`params`: AuthLogoutParams) -> Promise<Void>", arguments: arguments)203 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthLogoutParams) -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)204 }205 // MARK: Mocked `refreshToken`(`params`: AuthRefreshTokenParams)206 public func `refreshToken`(`params`: AuthRefreshTokenParams) -> Promise<UserTokenInfo> {207 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`refreshToken`(`params`: AuthRefreshTokenParams) -> Promise<UserTokenInfo>", arguments: [Mockingbird.ArgumentMatcher(`params`)])208 mockingContext.didInvoke(invocation)209 let implementation = stubbingContext.implementation(for: invocation, optional: false)210 if let concreteImplementation = implementation as? (AuthRefreshTokenParams) -> Promise<UserTokenInfo> {211 return concreteImplementation(`params`)212 } else {213 return (implementation as! () -> Promise<UserTokenInfo>)()214 }215 }216 public func `refreshToken`(`params`: @escaping @autoclosure () -> AuthRefreshTokenParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthRefreshTokenParams) -> Promise<UserTokenInfo>, Promise<UserTokenInfo>> {217 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]218 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`refreshToken`(`params`: AuthRefreshTokenParams) -> Promise<UserTokenInfo>", arguments: arguments)219 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthRefreshTokenParams) -> Promise<UserTokenInfo>, Promise<UserTokenInfo>>(mock: self, invocation: invocation)220 }221}222/// Create a source-attributed `NimbleSurvey.AuthService` concrete protocol mock instance.223public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.AuthService.Protocol) -> AuthServiceMock {224 return AuthServiceMock(sourceLocation: SourceLocation(file, line))225}226// MARK: - Mocked AuthVM227public final class AuthVMMock: NimbleSurvey.AuthVM, Mockingbird.Mock {228 static let staticMock = Mockingbird.StaticMock()229 public let mockingContext = Mockingbird.MockingContext()230 public let stubbingContext = Mockingbird.StubbingContext()231 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])232 public var sourceLocation: Mockingbird.SourceLocation? {233 get { return stubbingContext.sourceLocation }234 set {235 stubbingContext.sourceLocation = newValue236 AuthVMMock.staticMock.stubbingContext.sourceLocation = newValue237 }238 }239 // MARK: Mocked isAuthenticated240 public var `isAuthenticated`: ValueObservable<Bool> {241 get {242 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "isAuthenticated.get", arguments: [])243 mockingContext.didInvoke(invocation)244 return (stubbingContext.implementation(for: invocation) as! () -> ValueObservable<Bool>)()245 }246 }247 public func getIsAuthenticated() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<Bool>, ValueObservable<Bool>> {248 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "isAuthenticated.get", arguments: [])249 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<Bool>, ValueObservable<Bool>>(mock: self, invocation: invocation)250 }251 // MARK: Mocked user252 public var `user`: ValueObservable<UserInfo?> {253 get {254 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "user.get", arguments: [])255 mockingContext.didInvoke(invocation)256 return (stubbingContext.implementation(for: invocation) as! () -> ValueObservable<UserInfo?>)()257 }258 }259 public func getUser() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<UserInfo?>, ValueObservable<UserInfo?>> {260 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "user.get", arguments: [])261 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<UserInfo?>, ValueObservable<UserInfo?>>(mock: self, invocation: invocation)262 }263 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {264 Mockingbird.checkVersion(for: self)265 self.sourceLocation = sourceLocation266 }267 // MARK: Mocked `forgotPassword`(`params`: AuthForgotPasswordParams)268 public func `forgotPassword`(`params`: AuthForgotPasswordParams) -> Promise<Void> {269 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`forgotPassword`(`params`: AuthForgotPasswordParams) -> Promise<Void>", arguments: [Mockingbird.ArgumentMatcher(`params`)])270 mockingContext.didInvoke(invocation)271 let implementation = stubbingContext.implementation(for: invocation, optional: false)272 if let concreteImplementation = implementation as? (AuthForgotPasswordParams) -> Promise<Void> {273 return concreteImplementation(`params`)274 } else {275 return (implementation as! () -> Promise<Void>)()276 }277 }278 public func `forgotPassword`(`params`: @escaping @autoclosure () -> AuthForgotPasswordParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthForgotPasswordParams) -> Promise<Void>, Promise<Void>> {279 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]280 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`forgotPassword`(`params`: AuthForgotPasswordParams) -> Promise<Void>", arguments: arguments)281 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthForgotPasswordParams) -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)282 }283 // MARK: Mocked `login`(`params`: AuthLoginParams)284 public func `login`(`params`: AuthLoginParams) -> Promise<Void> {285 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`login`(`params`: AuthLoginParams) -> Promise<Void>", arguments: [Mockingbird.ArgumentMatcher(`params`)])286 mockingContext.didInvoke(invocation)287 let implementation = stubbingContext.implementation(for: invocation, optional: false)288 if let concreteImplementation = implementation as? (AuthLoginParams) -> Promise<Void> {289 return concreteImplementation(`params`)290 } else {291 return (implementation as! () -> Promise<Void>)()292 }293 }294 public func `login`(`params`: @escaping @autoclosure () -> AuthLoginParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthLoginParams) -> Promise<Void>, Promise<Void>> {295 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]296 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`login`(`params`: AuthLoginParams) -> Promise<Void>", arguments: arguments)297 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (AuthLoginParams) -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)298 }299 // MARK: Mocked `logout`()300 public func `logout`() -> Promise<Void> {301 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`logout`() -> Promise<Void>", arguments: [])302 mockingContext.didInvoke(invocation)303 let implementation = stubbingContext.implementation(for: invocation, optional: false)304 if let concreteImplementation = implementation as? () -> Promise<Void> {305 return concreteImplementation()306 } else {307 return (implementation as! () -> Promise<Void>)()308 }309 }310 public func `logout`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>> {311 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`logout`() -> Promise<Void>", arguments: [])312 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)313 }314 // MARK: Mocked `refreshToken`()315 public func `refreshToken`() -> Promise<Void> {316 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`refreshToken`() -> Promise<Void>", arguments: [])317 mockingContext.didInvoke(invocation)318 let implementation = stubbingContext.implementation(for: invocation, optional: false)319 if let concreteImplementation = implementation as? () -> Promise<Void> {320 return concreteImplementation()321 } else {322 return (implementation as! () -> Promise<Void>)()323 }324 }325 public func `refreshToken`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>> {326 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`refreshToken`() -> Promise<Void>", arguments: [])327 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)328 }329 // MARK: Mocked `retrieve`()330 public func `retrieve`() -> Promise<Void> {331 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`retrieve`() -> Promise<Void>", arguments: [])332 mockingContext.didInvoke(invocation)333 let implementation = stubbingContext.implementation(for: invocation, optional: false)334 if let concreteImplementation = implementation as? () -> Promise<Void> {335 return concreteImplementation()336 } else {337 return (implementation as! () -> Promise<Void>)()338 }339 }340 public func `retrieve`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>> {341 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`retrieve`() -> Promise<Void>", arguments: [])342 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)343 }344}345/// Create a source-attributed `NimbleSurvey.AuthVM` concrete protocol mock instance.346public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.AuthVM.Protocol) -> AuthVMMock {347 return AuthVMMock(sourceLocation: SourceLocation(file, line))348}349// MARK: - Mocked DateService350public final class DateServiceMock: NimbleSurvey.DateService, Mockingbird.Mock {351 static let staticMock = Mockingbird.StaticMock()352 public let mockingContext = Mockingbird.MockingContext()353 public let stubbingContext = Mockingbird.StubbingContext()354 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])355 public var sourceLocation: Mockingbird.SourceLocation? {356 get { return stubbingContext.sourceLocation }357 set {358 stubbingContext.sourceLocation = newValue359 DateServiceMock.staticMock.stubbingContext.sourceLocation = newValue360 }361 }362 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {363 Mockingbird.checkVersion(for: self)364 self.sourceLocation = sourceLocation365 }366 // MARK: Mocked `now`()367 public func `now`() -> Date {368 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`now`() -> Date", arguments: [])369 mockingContext.didInvoke(invocation)370 let implementation = stubbingContext.implementation(for: invocation, optional: false)371 if let concreteImplementation = implementation as? () -> Date {372 return concreteImplementation()373 } else {374 return (implementation as! () -> Date)()375 }376 }377 public func `now`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Date, Date> {378 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`now`() -> Date", arguments: [])379 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Date, Date>(mock: self, invocation: invocation)380 }381}382/// Create a source-attributed `NimbleSurvey.DateService` concrete protocol mock instance.383public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.DateService.Protocol) -> DateServiceMock {384 return DateServiceMock(sourceLocation: SourceLocation(file, line))385}386// MARK: - Mocked HomeVM387public final class HomeVMMock: NimbleSurvey.HomeVM, Mockingbird.Mock {388 static let staticMock = Mockingbird.StaticMock()389 public let mockingContext = Mockingbird.MockingContext()390 public let stubbingContext = Mockingbird.StubbingContext()391 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])392 public var sourceLocation: Mockingbird.SourceLocation? {393 get { return stubbingContext.sourceLocation }394 set {395 stubbingContext.sourceLocation = newValue396 HomeVMMock.staticMock.stubbingContext.sourceLocation = newValue397 }398 }399 // MARK: Mocked currentDateText400 public var `currentDateText`: Observable<String> {401 get {402 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "currentDateText.get", arguments: [])403 mockingContext.didInvoke(invocation)404 return (stubbingContext.implementation(for: invocation) as! () -> Observable<String>)()405 }406 }407 public func getCurrentDateText() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<String>, Observable<String>> {408 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "currentDateText.get", arguments: [])409 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<String>, Observable<String>>(mock: self, invocation: invocation)410 }411 // MARK: Mocked focusIndex412 public var `focusIndex`: ValueObservable<Int> {413 get {414 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "focusIndex.get", arguments: [])415 mockingContext.didInvoke(invocation)416 return (stubbingContext.implementation(for: invocation) as! () -> ValueObservable<Int>)()417 }418 }419 public func getFocusIndex() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<Int>, ValueObservable<Int>> {420 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "focusIndex.get", arguments: [])421 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<Int>, ValueObservable<Int>>(mock: self, invocation: invocation)422 }423 // MARK: Mocked focusItem424 public var `focusItem`: Observable<SurveyInfo?> {425 get {426 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "focusItem.get", arguments: [])427 mockingContext.didInvoke(invocation)428 return (stubbingContext.implementation(for: invocation) as! () -> Observable<SurveyInfo?>)()429 }430 }431 public func getFocusItem() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<SurveyInfo?>, Observable<SurveyInfo?>> {432 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "focusItem.get", arguments: [])433 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<SurveyInfo?>, Observable<SurveyInfo?>>(mock: self, invocation: invocation)434 }435 // MARK: Mocked items436 public var `items`: ValueObservable<[SurveyInfo]> {437 get {438 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "items.get", arguments: [])439 mockingContext.didInvoke(invocation)440 return (stubbingContext.implementation(for: invocation) as! () -> ValueObservable<[SurveyInfo]>)()441 }442 }443 public func getItems() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<[SurveyInfo]>, ValueObservable<[SurveyInfo]>> {444 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "items.get", arguments: [])445 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<[SurveyInfo]>, ValueObservable<[SurveyInfo]>>(mock: self, invocation: invocation)446 }447 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {448 Mockingbird.checkVersion(for: self)449 self.sourceLocation = sourceLocation450 }451 // MARK: Mocked `refresh`(`force`: Bool)452 public func `refresh`(`force`: Bool) -> Promise<Void> {453 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`refresh`(`force`: Bool) -> Promise<Void>", arguments: [Mockingbird.ArgumentMatcher(`force`)])454 mockingContext.didInvoke(invocation)455 let implementation = stubbingContext.implementation(for: invocation, optional: false)456 if let concreteImplementation = implementation as? (Bool) -> Promise<Void> {457 return concreteImplementation(`force`)458 } else {459 return (implementation as! () -> Promise<Void>)()460 }461 }462 public func `refresh`(`force`: @escaping @autoclosure () -> Bool) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (Bool) -> Promise<Void>, Promise<Void>> {463 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`force`)]464 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`refresh`(`force`: Bool) -> Promise<Void>", arguments: arguments)465 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (Bool) -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)466 }467 // MARK: Mocked `setFocusIndex`(_ `index`: Int)468 public func `setFocusIndex`(_ `index`: Int) -> Void {469 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setFocusIndex`(_ `index`: Int) -> Void", arguments: [Mockingbird.ArgumentMatcher(`index`)])470 mockingContext.didInvoke(invocation)471 let implementation = stubbingContext.implementation(for: invocation, optional: true)472 if let concreteImplementation = implementation as? (Int) -> Void {473 concreteImplementation(`index`)474 } else {475 (implementation as? () -> Void)?()476 }477 }478 public func `setFocusIndex`(_ `index`: @escaping @autoclosure () -> Int) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (Int) -> Void, Void> {479 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`index`)]480 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setFocusIndex`(_ `index`: Int) -> Void", arguments: arguments)481 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (Int) -> Void, Void>(mock: self, invocation: invocation)482 }483}484/// Create a source-attributed `NimbleSurvey.HomeVM` concrete protocol mock instance.485public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.HomeVM.Protocol) -> HomeVMMock {486 return HomeVMMock(sourceLocation: SourceLocation(file, line))487}488// MARK: - Mocked HttpService489public final class HttpServiceMock: NimbleSurvey.HttpService, Mockingbird.Mock {490 static let staticMock = Mockingbird.StaticMock()491 public let mockingContext = Mockingbird.MockingContext()492 public let stubbingContext = Mockingbird.StubbingContext()493 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])494 public var sourceLocation: Mockingbird.SourceLocation? {495 get { return stubbingContext.sourceLocation }496 set {497 stubbingContext.sourceLocation = newValue498 HttpServiceMock.staticMock.stubbingContext.sourceLocation = newValue499 }500 }501 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {502 Mockingbird.checkVersion(for: self)503 self.sourceLocation = sourceLocation504 }505 // MARK: Mocked `request`(`method`: HttpMethod, `baseUrl`: String, `endPoint`: String, `params`: HttpParametable?, `headers`: HttpHeaders?, `interceptor`: RequestInterceptor?)506 public func `request`(`method`: HttpMethod, `baseUrl`: String, `endPoint`: String, `params`: HttpParametable?, `headers`: HttpHeaders?, `interceptor`: RequestInterceptor?) -> Promise<Data> {507 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`request`(`method`: HttpMethod, `baseUrl`: String, `endPoint`: String, `params`: HttpParametable?, `headers`: HttpHeaders?, `interceptor`: RequestInterceptor?) -> Promise<Data>", arguments: [Mockingbird.ArgumentMatcher(`method`), Mockingbird.ArgumentMatcher(`baseUrl`), Mockingbird.ArgumentMatcher(`endPoint`), Mockingbird.ArgumentMatcher(`params`), Mockingbird.ArgumentMatcher(`headers`), Mockingbird.ArgumentMatcher(`interceptor`)])508 mockingContext.didInvoke(invocation)509 let implementation = stubbingContext.implementation(for: invocation, optional: false)510 if let concreteImplementation = implementation as? (HttpMethod, String, String, HttpParametable?, HttpHeaders?, RequestInterceptor?) -> Promise<Data> {511 return concreteImplementation(`method`, `baseUrl`, `endPoint`, `params`, `headers`, `interceptor`)512 } else {513 return (implementation as! () -> Promise<Data>)()514 }515 }516 public func `request`(`method`: @escaping @autoclosure () -> HttpMethod, `baseUrl`: @escaping @autoclosure () -> String, `endPoint`: @escaping @autoclosure () -> String, `params`: @escaping @autoclosure () -> HttpParametable?, `headers`: @escaping @autoclosure () -> HttpHeaders?, `interceptor`: @escaping @autoclosure () -> RequestInterceptor?) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (HttpMethod, String, String, HttpParametable?, HttpHeaders?, RequestInterceptor?) -> Promise<Data>, Promise<Data>> {517 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`method`), Mockingbird.resolve(`baseUrl`), Mockingbird.resolve(`endPoint`), Mockingbird.resolve(`params`), Mockingbird.resolve(`headers`), Mockingbird.resolve(`interceptor`)]518 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`request`(`method`: HttpMethod, `baseUrl`: String, `endPoint`: String, `params`: HttpParametable?, `headers`: HttpHeaders?, `interceptor`: RequestInterceptor?) -> Promise<Data>", arguments: arguments)519 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (HttpMethod, String, String, HttpParametable?, HttpHeaders?, RequestInterceptor?) -> Promise<Data>, Promise<Data>>(mock: self, invocation: invocation)520 }521}522/// Create a source-attributed `NimbleSurvey.HttpService` concrete protocol mock instance.523public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.HttpService.Protocol) -> HttpServiceMock {524 return HttpServiceMock(sourceLocation: SourceLocation(file, line))525}526// MARK: - Mocked LandingVM527public final class LandingVMMock: NimbleSurvey.LandingVM, Mockingbird.Mock {528 static let staticMock = Mockingbird.StaticMock()529 public let mockingContext = Mockingbird.MockingContext()530 public let stubbingContext = Mockingbird.StubbingContext()531 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])532 public var sourceLocation: Mockingbird.SourceLocation? {533 get { return stubbingContext.sourceLocation }534 set {535 stubbingContext.sourceLocation = newValue536 LandingVMMock.staticMock.stubbingContext.sourceLocation = newValue537 }538 }539 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {540 Mockingbird.checkVersion(for: self)541 self.sourceLocation = sourceLocation542 }543 // MARK: Mocked `fetch`()544 public func `fetch`() -> Promise<Void> {545 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`fetch`() -> Promise<Void>", arguments: [])546 mockingContext.didInvoke(invocation)547 let implementation = stubbingContext.implementation(for: invocation, optional: false)548 if let concreteImplementation = implementation as? () -> Promise<Void> {549 return concreteImplementation()550 } else {551 return (implementation as! () -> Promise<Void>)()552 }553 }554 public func `fetch`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>> {555 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`fetch`() -> Promise<Void>", arguments: [])556 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)557 }558}559/// Create a source-attributed `NimbleSurvey.LandingVM` concrete protocol mock instance.560public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.LandingVM.Protocol) -> LandingVMMock {561 return LandingVMMock(sourceLocation: SourceLocation(file, line))562}563// MARK: - Mocked LoginVM564public final class LoginVMMock: NimbleSurvey.LoginVM, Mockingbird.Mock {565 static let staticMock = Mockingbird.StaticMock()566 public let mockingContext = Mockingbird.MockingContext()567 public let stubbingContext = Mockingbird.StubbingContext()568 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])569 public var sourceLocation: Mockingbird.SourceLocation? {570 get { return stubbingContext.sourceLocation }571 set {572 stubbingContext.sourceLocation = newValue573 LoginVMMock.staticMock.stubbingContext.sourceLocation = newValue574 }575 }576 // MARK: Mocked isValid577 public var `isValid`: Observable<Bool> {578 get {579 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "isValid.get", arguments: [])580 mockingContext.didInvoke(invocation)581 return (stubbingContext.implementation(for: invocation) as! () -> Observable<Bool>)()582 }583 }584 public func getIsValid() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<Bool>, Observable<Bool>> {585 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "isValid.get", arguments: [])586 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> Observable<Bool>, Observable<Bool>>(mock: self, invocation: invocation)587 }588 // MARK: Mocked state589 public var `state`: ValueObservable<NimbleSurvey.LoginState> {590 get {591 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "state.get", arguments: [])592 mockingContext.didInvoke(invocation)593 return (stubbingContext.implementation(for: invocation) as! () -> ValueObservable<NimbleSurvey.LoginState>)()594 }595 }596 public func getState() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<NimbleSurvey.LoginState>, ValueObservable<NimbleSurvey.LoginState>> {597 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "state.get", arguments: [])598 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> ValueObservable<NimbleSurvey.LoginState>, ValueObservable<NimbleSurvey.LoginState>>(mock: self, invocation: invocation)599 }600 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {601 Mockingbird.checkVersion(for: self)602 self.sourceLocation = sourceLocation603 }604 // MARK: Mocked `login`()605 public func `login`() -> Promise<Void> {606 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`login`() -> Promise<Void>", arguments: [])607 mockingContext.didInvoke(invocation)608 let implementation = stubbingContext.implementation(for: invocation, optional: false)609 if let concreteImplementation = implementation as? () -> Promise<Void> {610 return concreteImplementation()611 } else {612 return (implementation as! () -> Promise<Void>)()613 }614 }615 public func `login`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>> {616 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`login`() -> Promise<Void>", arguments: [])617 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<Void>, Promise<Void>>(mock: self, invocation: invocation)618 }619 // MARK: Mocked `setEmail`(_ `text`: String?)620 public func `setEmail`(_ `text`: String?) -> Void {621 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setEmail`(_ `text`: String?) -> Void", arguments: [Mockingbird.ArgumentMatcher(`text`)])622 mockingContext.didInvoke(invocation)623 let implementation = stubbingContext.implementation(for: invocation, optional: true)624 if let concreteImplementation = implementation as? (String?) -> Void {625 concreteImplementation(`text`)626 } else {627 (implementation as? () -> Void)?()628 }629 }630 public func `setEmail`(_ `text`: @escaping @autoclosure () -> String?) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (String?) -> Void, Void> {631 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`text`)]632 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setEmail`(_ `text`: String?) -> Void", arguments: arguments)633 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (String?) -> Void, Void>(mock: self, invocation: invocation)634 }635 // MARK: Mocked `setPassword`(_ `text`: String?)636 public func `setPassword`(_ `text`: String?) -> Void {637 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setPassword`(_ `text`: String?) -> Void", arguments: [Mockingbird.ArgumentMatcher(`text`)])638 mockingContext.didInvoke(invocation)639 let implementation = stubbingContext.implementation(for: invocation, optional: true)640 if let concreteImplementation = implementation as? (String?) -> Void {641 concreteImplementation(`text`)642 } else {643 (implementation as? () -> Void)?()644 }645 }646 public func `setPassword`(_ `text`: @escaping @autoclosure () -> String?) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (String?) -> Void, Void> {647 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`text`)]648 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`setPassword`(_ `text`: String?) -> Void", arguments: arguments)649 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (String?) -> Void, Void>(mock: self, invocation: invocation)650 }651}652/// Create a source-attributed `NimbleSurvey.LoginVM` concrete protocol mock instance.653public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.LoginVM.Protocol) -> LoginVMMock {654 return LoginVMMock(sourceLocation: SourceLocation(file, line))655}656// MARK: - Mocked SurveyService657public final class SurveyServiceMock: NimbleSurvey.SurveyService, Mockingbird.Mock {658 static let staticMock = Mockingbird.StaticMock()659 public let mockingContext = Mockingbird.MockingContext()660 public let stubbingContext = Mockingbird.StubbingContext()661 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])662 public var sourceLocation: Mockingbird.SourceLocation? {663 get { return stubbingContext.sourceLocation }664 set {665 stubbingContext.sourceLocation = newValue666 SurveyServiceMock.staticMock.stubbingContext.sourceLocation = newValue667 }668 }669 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {670 Mockingbird.checkVersion(for: self)671 self.sourceLocation = sourceLocation672 }673 // MARK: Mocked `list`(`params`: SurveyListParams)674 public func `list`(`params`: SurveyListParams) -> Promise<NimbleSurvey.ListResponse<SurveyInfo>> {675 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`list`(`params`: SurveyListParams) -> Promise<NimbleSurvey.ListResponse<SurveyInfo>>", arguments: [Mockingbird.ArgumentMatcher(`params`)])676 mockingContext.didInvoke(invocation)677 let implementation = stubbingContext.implementation(for: invocation, optional: false)678 if let concreteImplementation = implementation as? (SurveyListParams) -> Promise<NimbleSurvey.ListResponse<SurveyInfo>> {679 return concreteImplementation(`params`)680 } else {681 return (implementation as! () -> Promise<NimbleSurvey.ListResponse<SurveyInfo>>)()682 }683 }684 public func `list`(`params`: @escaping @autoclosure () -> SurveyListParams) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (SurveyListParams) -> Promise<NimbleSurvey.ListResponse<SurveyInfo>>, Promise<NimbleSurvey.ListResponse<SurveyInfo>>> {685 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`params`)]686 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`list`(`params`: SurveyListParams) -> Promise<NimbleSurvey.ListResponse<SurveyInfo>>", arguments: arguments)687 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (SurveyListParams) -> Promise<NimbleSurvey.ListResponse<SurveyInfo>>, Promise<NimbleSurvey.ListResponse<SurveyInfo>>>(mock: self, invocation: invocation)688 }689}690/// Create a source-attributed `NimbleSurvey.SurveyService` concrete protocol mock instance.691public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.SurveyService.Protocol) -> SurveyServiceMock {692 return SurveyServiceMock(sourceLocation: SourceLocation(file, line))693}694// MARK: - Mocked TimerService695public final class TimerServiceMock: NimbleSurvey.TimerService, Mockingbird.Mock {696 static let staticMock = Mockingbird.StaticMock()697 public let mockingContext = Mockingbird.MockingContext()698 public let stubbingContext = Mockingbird.StubbingContext()699 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])700 public var sourceLocation: Mockingbird.SourceLocation? {701 get { return stubbingContext.sourceLocation }702 set {703 stubbingContext.sourceLocation = newValue704 TimerServiceMock.staticMock.stubbingContext.sourceLocation = newValue705 }706 }707 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {708 Mockingbird.checkVersion(for: self)709 self.sourceLocation = sourceLocation710 }711 // MARK: Mocked `scheduledTimer`(`withTimeInterval` `interval`: TimeInterval, `repeats`: Bool, `block`: @escaping (Timer) -> Void)712 public func `scheduledTimer`(`withTimeInterval` `interval`: TimeInterval, `repeats`: Bool, `block`: @escaping (Timer) -> Void) -> Timer {713 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`scheduledTimer`(`withTimeInterval` `interval`: TimeInterval, `repeats`: Bool, `block`: @escaping (Timer) -> Void) -> Timer", arguments: [Mockingbird.ArgumentMatcher(`interval`), Mockingbird.ArgumentMatcher(`repeats`), Mockingbird.ArgumentMatcher(`block`)])714 mockingContext.didInvoke(invocation)715 let implementation = stubbingContext.implementation(for: invocation, optional: false)716 if let concreteImplementation = implementation as? (TimeInterval, Bool, @escaping (Timer) -> Void) -> Timer {717 return concreteImplementation(`interval`, `repeats`, `block`)718 } else {719 return (implementation as! () -> Timer)()720 }721 }722 public func `scheduledTimer`(`withTimeInterval` `interval`: @escaping @autoclosure () -> TimeInterval, `repeats`: @escaping @autoclosure () -> Bool, `block`: @escaping @autoclosure () -> (Timer) -> Void) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (TimeInterval, Bool, @escaping (Timer) -> Void) -> Timer, Timer> {723 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`interval`), Mockingbird.resolve(`repeats`), Mockingbird.resolve(`block`)]724 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`scheduledTimer`(`withTimeInterval` `interval`: TimeInterval, `repeats`: Bool, `block`: @escaping (Timer) -> Void) -> Timer", arguments: arguments)725 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (TimeInterval, Bool, @escaping (Timer) -> Void) -> Timer, Timer>(mock: self, invocation: invocation)726 }727}728/// Create a source-attributed `NimbleSurvey.TimerService` concrete protocol mock instance.729public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.TimerService.Protocol) -> TimerServiceMock {730 return TimerServiceMock(sourceLocation: SourceLocation(file, line))731}732// MARK: - Mocked UserService733public final class UserServiceMock: NimbleSurvey.UserService, Mockingbird.Mock {734 static let staticMock = Mockingbird.StaticMock()735 public let mockingContext = Mockingbird.MockingContext()736 public let stubbingContext = Mockingbird.StubbingContext()737 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])738 public var sourceLocation: Mockingbird.SourceLocation? {739 get { return stubbingContext.sourceLocation }740 set {741 stubbingContext.sourceLocation = newValue742 UserServiceMock.staticMock.stubbingContext.sourceLocation = newValue743 }744 }745 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {746 Mockingbird.checkVersion(for: self)747 self.sourceLocation = sourceLocation748 }749 // MARK: Mocked `me`()750 public func `me`() -> Promise<UserInfo> {751 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`me`() -> Promise<UserInfo>", arguments: [])752 mockingContext.didInvoke(invocation)753 let implementation = stubbingContext.implementation(for: invocation, optional: false)754 if let concreteImplementation = implementation as? () -> Promise<UserInfo> {755 return concreteImplementation()756 } else {757 return (implementation as! () -> Promise<UserInfo>)()758 }759 }760 public func `me`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<UserInfo>, Promise<UserInfo>> {761 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`me`() -> Promise<UserInfo>", arguments: [])762 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> Promise<UserInfo>, Promise<UserInfo>>(mock: self, invocation: invocation)763 }764}765/// Create a source-attributed `NimbleSurvey.UserService` concrete protocol mock instance.766public func mock(file: StaticString = #file, line: UInt = #line, _ type: NimbleSurvey.UserService.Protocol) -> UserServiceMock {...
iOSMockingBirdMocks.generated.swift
Source:iOSMockingBirdMocks.generated.swift
...29 public enum InitializerProxy {}30 // MARK: Mocked `application`(_ `application`: UIApplication, `configurationForConnecting` `connectingSceneSession`: UISceneSession, `options`: UIScene.ConnectionOptions)31 public override func `application`(_ `application`: UIApplication, `configurationForConnecting` `connectingSceneSession`: UISceneSession, `options`: UIScene.ConnectionOptions) -> UISceneConfiguration {32 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`application`(_ `application`: UIApplication, `configurationForConnecting` `connectingSceneSession`: UISceneSession, `options`: UIScene.ConnectionOptions) -> UISceneConfiguration", arguments: [Mockingbird.ArgumentMatcher(`application`), Mockingbird.ArgumentMatcher(`connectingSceneSession`), Mockingbird.ArgumentMatcher(`options`)])33 mockingContext.didInvoke(invocation)34 let implementation = stubbingContext.implementation(for: invocation, optional: false)35 if let concreteImplementation = implementation as? (UIApplication, UISceneSession, UIScene.ConnectionOptions) -> UISceneConfiguration {36 return concreteImplementation(`application`, `connectingSceneSession`, `options`)37 } else {38 return (implementation as! () -> UISceneConfiguration)()39 }40 }41 public func `application`(_ `application`: @escaping @autoclosure () -> UIApplication, `configurationForConnecting` `connectingSceneSession`: @escaping @autoclosure () -> UISceneSession, `options`: @escaping @autoclosure () -> UIScene.ConnectionOptions) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIApplication, UISceneSession, UIScene.ConnectionOptions) -> UISceneConfiguration, UISceneConfiguration> {42 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`application`), Mockingbird.resolve(`connectingSceneSession`), Mockingbird.resolve(`options`)]43 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`application`(_ `application`: UIApplication, `configurationForConnecting` `connectingSceneSession`: UISceneSession, `options`: UIScene.ConnectionOptions) -> UISceneConfiguration", arguments: arguments)44 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIApplication, UISceneSession, UIScene.ConnectionOptions) -> UISceneConfiguration, UISceneConfiguration>(mock: self, invocation: invocation)45 }46 // MARK: Mocked `application`(_ `application`: UIApplication, `didDiscardSceneSessions` `sceneSessions`: Set<UISceneSession>)47 public override func `application`(_ `application`: UIApplication, `didDiscardSceneSessions` `sceneSessions`: Set<UISceneSession>) -> Void {48 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`application`(_ `application`: UIApplication, `didDiscardSceneSessions` `sceneSessions`: Set<UISceneSession>) -> Void", arguments: [Mockingbird.ArgumentMatcher(`application`), Mockingbird.ArgumentMatcher(`sceneSessions`)])49 mockingContext.didInvoke(invocation)50 let implementation = stubbingContext.implementation(for: invocation, optional: true)51 if let concreteImplementation = implementation as? (UIApplication, Set<UISceneSession>) -> Void {52 concreteImplementation(`application`, `sceneSessions`)53 } else {54 (implementation as? () -> Void)?()55 }56 }57 public func `application`(_ `application`: @escaping @autoclosure () -> UIApplication, `didDiscardSceneSessions` `sceneSessions`: @escaping @autoclosure () -> Set<UISceneSession>) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIApplication, Set<UISceneSession>) -> Void, Void> {58 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`application`), Mockingbird.resolve(`sceneSessions`)]59 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`application`(_ `application`: UIApplication, `didDiscardSceneSessions` `sceneSessions`: Set<UISceneSession>) -> Void", arguments: arguments)60 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIApplication, Set<UISceneSession>) -> Void, Void>(mock: self, invocation: invocation)61 }62 // MARK: Mocked `application`(_ `application`: UIApplication, `didFinishLaunchingWithOptions` `launchOptions`: [UIApplication.LaunchOptionsKey: Any]?)63 public override func `application`(_ `application`: UIApplication, `didFinishLaunchingWithOptions` `launchOptions`: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {64 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`application`(_ `application`: UIApplication, `didFinishLaunchingWithOptions` `launchOptions`: [UIApplication.LaunchOptionsKey: Any]?) -> Bool", arguments: [Mockingbird.ArgumentMatcher(`application`), Mockingbird.ArgumentMatcher(`launchOptions`)])65 mockingContext.didInvoke(invocation)66 let implementation = stubbingContext.implementation(for: invocation, optional: false)67 if let concreteImplementation = implementation as? (UIApplication, [UIApplication.LaunchOptionsKey: Any]?) -> Bool {68 return concreteImplementation(`application`, `launchOptions`)69 } else {70 return (implementation as! () -> Bool)()71 }72 }73 public func `application`(_ `application`: @escaping @autoclosure () -> UIApplication, `didFinishLaunchingWithOptions` `launchOptions`: @escaping @autoclosure () -> [UIApplication.LaunchOptionsKey: Any]?) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIApplication, [UIApplication.LaunchOptionsKey: Any]?) -> Bool, Bool> {74 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`application`), Mockingbird.resolve(`launchOptions`)]75 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`application`(_ `application`: UIApplication, `didFinishLaunchingWithOptions` `launchOptions`: [UIApplication.LaunchOptionsKey: Any]?) -> Bool", arguments: arguments)76 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIApplication, [UIApplication.LaunchOptionsKey: Any]?) -> Bool, Bool>(mock: self, invocation: invocation)77 }78}79/// Initialize an initializable class mock of `iOSMockingBird.AppDelegate`.80public func mock(_ type: iOSMockingBird.AppDelegate.Type, file: StaticString = #file, line: UInt = #line) -> AppDelegateMock.InitializerProxy.Type {81 return AppDelegateMock.InitializerProxy.self82}83// MARK: - Mocked RestAPI84public final class RestAPIMock: iOSMockingBird.RestAPI, Mockingbird.Mock {85 static let staticMock = Mockingbird.StaticMock()86 public let mockingContext = Mockingbird.MockingContext()87 public let stubbingContext = Mockingbird.StubbingContext()88 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.11.1", "module_name": "iOSMockingBird"])89 public var sourceLocation: Mockingbird.SourceLocation? {90 get { return stubbingContext.sourceLocation }91 set {92 stubbingContext.sourceLocation = newValue93 RestAPIMock.staticMock.stubbingContext.sourceLocation = newValue94 }95 }96 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {97 super.init()98 Mockingbird.checkVersion(for: self)99 self.sourceLocation = sourceLocation100 }101 // MARK: Mocked `index`(`ascOrder`: Bool)102 public override func `index`(`ascOrder`: Bool) -> AnyPublisher<[String], URLError> {103 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`index`(`ascOrder`: Bool) -> AnyPublisher<[String], URLError>", arguments: [Mockingbird.ArgumentMatcher(`ascOrder`)])104 mockingContext.didInvoke(invocation)105 let implementation = stubbingContext.implementation(for: invocation, optional: false)106 if let concreteImplementation = implementation as? (Bool) -> AnyPublisher<[String], URLError> {107 return concreteImplementation(`ascOrder`)108 } else {109 return (implementation as! () -> AnyPublisher<[String], URLError>)()110 }111 }112 public func `index`(`ascOrder`: @escaping @autoclosure () -> Bool) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (Bool) -> AnyPublisher<[String], URLError>, AnyPublisher<[String], URLError>> {113 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`ascOrder`)]114 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`index`(`ascOrder`: Bool) -> AnyPublisher<[String], URLError>", arguments: arguments)115 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (Bool) -> AnyPublisher<[String], URLError>, AnyPublisher<[String], URLError>>(mock: self, invocation: invocation)116 }117}118/// Initialize a class mock of `iOSMockingBird.RestAPI`.119public func mock(_ type: iOSMockingBird.RestAPI.Type, file: StaticString = #file, line: UInt = #line) -> RestAPIMock {120 return RestAPIMock(sourceLocation: SourceLocation(file, line))121}122// MARK: - Mocked SceneDelegate123public final class SceneDelegateMock: iOSMockingBird.SceneDelegate, Mockingbird.Mock {124 static let staticMock = Mockingbird.StaticMock()125 public let mockingContext = Mockingbird.MockingContext()126 public let stubbingContext = Mockingbird.StubbingContext()127 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.11.1", "module_name": "iOSMockingBird"])128 public var sourceLocation: Mockingbird.SourceLocation? {129 get { return stubbingContext.sourceLocation }130 set {131 stubbingContext.sourceLocation = newValue132 SceneDelegateMock.staticMock.stubbingContext.sourceLocation = newValue133 }134 }135 public enum InitializerProxy {}136 // MARK: Mocked window137 override public var `window`: UIWindow? {138 get {139 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "window.get", arguments: [])140 mockingContext.didInvoke(invocation)141 return (stubbingContext.implementation(for: invocation) as! () -> UIWindow?)()142 }143 set {144 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "window.set", arguments: [ArgumentMatcher(newValue)])145 mockingContext.didInvoke(invocation)146 let implementation = stubbingContext.implementation(for: invocation, optional: true)147 if let concreteImplementation = implementation as? (UIWindow?) -> Void {148 concreteImplementation(newValue)149 } else {150 (implementation as? () -> Void)?()151 }152 }153 }154 public func getWindow() -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> UIWindow?, UIWindow?> {155 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "window.get", arguments: [])156 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, () -> UIWindow?, UIWindow?>(mock: self, invocation: invocation)157 }158 public func setWindow(_ newValue: @escaping @autoclosure () -> UIWindow?) -> Mockingbird.Mockable<Mockingbird.VariableDeclaration, (UIWindow?) -> Void, Void> {159 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(newValue)]160 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "window.set", arguments: arguments)161 return Mockingbird.Mockable<Mockingbird.VariableDeclaration, (UIWindow?) -> Void, Void>(mock: self, invocation: invocation)162 }163 // MARK: Mocked `scene`(_ `scene`: UIScene, `willConnectTo` `session`: UISceneSession, `options` `connectionOptions`: UIScene.ConnectionOptions)164 public override func `scene`(_ `scene`: UIScene, `willConnectTo` `session`: UISceneSession, `options` `connectionOptions`: UIScene.ConnectionOptions) -> Void {165 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`scene`(_ `scene`: UIScene, `willConnectTo` `session`: UISceneSession, `options` `connectionOptions`: UIScene.ConnectionOptions) -> Void", arguments: [Mockingbird.ArgumentMatcher(`scene`), Mockingbird.ArgumentMatcher(`session`), Mockingbird.ArgumentMatcher(`connectionOptions`)])166 mockingContext.didInvoke(invocation)167 let implementation = stubbingContext.implementation(for: invocation, optional: true)168 if let concreteImplementation = implementation as? (UIScene, UISceneSession, UIScene.ConnectionOptions) -> Void {169 concreteImplementation(`scene`, `session`, `connectionOptions`)170 } else {171 (implementation as? () -> Void)?()172 }173 }174 public func `scene`(_ `scene`: @escaping @autoclosure () -> UIScene, `willConnectTo` `session`: @escaping @autoclosure () -> UISceneSession, `options` `connectionOptions`: @escaping @autoclosure () -> UIScene.ConnectionOptions) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene, UISceneSession, UIScene.ConnectionOptions) -> Void, Void> {175 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`scene`), Mockingbird.resolve(`session`), Mockingbird.resolve(`connectionOptions`)]176 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`scene`(_ `scene`: UIScene, `willConnectTo` `session`: UISceneSession, `options` `connectionOptions`: UIScene.ConnectionOptions) -> Void", arguments: arguments)177 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene, UISceneSession, UIScene.ConnectionOptions) -> Void, Void>(mock: self, invocation: invocation)178 }179 // MARK: Mocked `sceneDidBecomeActive`(_ `scene`: UIScene)180 public override func `sceneDidBecomeActive`(_ `scene`: UIScene) -> Void {181 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneDidBecomeActive`(_ `scene`: UIScene) -> Void", arguments: [Mockingbird.ArgumentMatcher(`scene`)])182 mockingContext.didInvoke(invocation)183 let implementation = stubbingContext.implementation(for: invocation, optional: true)184 if let concreteImplementation = implementation as? (UIScene) -> Void {185 concreteImplementation(`scene`)186 } else {187 (implementation as? () -> Void)?()188 }189 }190 public func `sceneDidBecomeActive`(_ `scene`: @escaping @autoclosure () -> UIScene) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void> {191 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`scene`)]192 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneDidBecomeActive`(_ `scene`: UIScene) -> Void", arguments: arguments)193 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void>(mock: self, invocation: invocation)194 }195 // MARK: Mocked `sceneDidDisconnect`(_ `scene`: UIScene)196 public override func `sceneDidDisconnect`(_ `scene`: UIScene) -> Void {197 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneDidDisconnect`(_ `scene`: UIScene) -> Void", arguments: [Mockingbird.ArgumentMatcher(`scene`)])198 mockingContext.didInvoke(invocation)199 let implementation = stubbingContext.implementation(for: invocation, optional: true)200 if let concreteImplementation = implementation as? (UIScene) -> Void {201 concreteImplementation(`scene`)202 } else {203 (implementation as? () -> Void)?()204 }205 }206 public func `sceneDidDisconnect`(_ `scene`: @escaping @autoclosure () -> UIScene) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void> {207 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`scene`)]208 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneDidDisconnect`(_ `scene`: UIScene) -> Void", arguments: arguments)209 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void>(mock: self, invocation: invocation)210 }211 // MARK: Mocked `sceneDidEnterBackground`(_ `scene`: UIScene)212 public override func `sceneDidEnterBackground`(_ `scene`: UIScene) -> Void {213 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneDidEnterBackground`(_ `scene`: UIScene) -> Void", arguments: [Mockingbird.ArgumentMatcher(`scene`)])214 mockingContext.didInvoke(invocation)215 let implementation = stubbingContext.implementation(for: invocation, optional: true)216 if let concreteImplementation = implementation as? (UIScene) -> Void {217 concreteImplementation(`scene`)218 } else {219 (implementation as? () -> Void)?()220 }221 }222 public func `sceneDidEnterBackground`(_ `scene`: @escaping @autoclosure () -> UIScene) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void> {223 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`scene`)]224 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneDidEnterBackground`(_ `scene`: UIScene) -> Void", arguments: arguments)225 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void>(mock: self, invocation: invocation)226 }227 // MARK: Mocked `sceneWillEnterForeground`(_ `scene`: UIScene)228 public override func `sceneWillEnterForeground`(_ `scene`: UIScene) -> Void {229 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneWillEnterForeground`(_ `scene`: UIScene) -> Void", arguments: [Mockingbird.ArgumentMatcher(`scene`)])230 mockingContext.didInvoke(invocation)231 let implementation = stubbingContext.implementation(for: invocation, optional: true)232 if let concreteImplementation = implementation as? (UIScene) -> Void {233 concreteImplementation(`scene`)234 } else {235 (implementation as? () -> Void)?()236 }237 }238 public func `sceneWillEnterForeground`(_ `scene`: @escaping @autoclosure () -> UIScene) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void> {239 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`scene`)]240 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneWillEnterForeground`(_ `scene`: UIScene) -> Void", arguments: arguments)241 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void>(mock: self, invocation: invocation)242 }243 // MARK: Mocked `sceneWillResignActive`(_ `scene`: UIScene)244 public override func `sceneWillResignActive`(_ `scene`: UIScene) -> Void {245 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneWillResignActive`(_ `scene`: UIScene) -> Void", arguments: [Mockingbird.ArgumentMatcher(`scene`)])246 mockingContext.didInvoke(invocation)247 let implementation = stubbingContext.implementation(for: invocation, optional: true)248 if let concreteImplementation = implementation as? (UIScene) -> Void {249 concreteImplementation(`scene`)250 } else {251 (implementation as? () -> Void)?()252 }253 }254 public func `sceneWillResignActive`(_ `scene`: @escaping @autoclosure () -> UIScene) -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void> {255 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`scene`)]256 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`sceneWillResignActive`(_ `scene`: UIScene) -> Void", arguments: arguments)257 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, (UIScene) -> Void, Void>(mock: self, invocation: invocation)258 }259}260/// Initialize an initializable class mock of `iOSMockingBird.SceneDelegate`.261public func mock(_ type: iOSMockingBird.SceneDelegate.Type, file: StaticString = #file, line: UInt = #line) -> SceneDelegateMock.InitializerProxy.Type {262 return SceneDelegateMock.InitializerProxy.self263}264// MARK: - Mocked UseCase265public final class UseCaseMock: iOSMockingBird.UseCase, Mockingbird.Mock {266 static let staticMock = Mockingbird.StaticMock()267 public let mockingContext = Mockingbird.MockingContext()268 public let stubbingContext = Mockingbird.StubbingContext()269 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.11.1", "module_name": "iOSMockingBird"])270 public var sourceLocation: Mockingbird.SourceLocation? {271 get { return stubbingContext.sourceLocation }272 set {273 stubbingContext.sourceLocation = newValue274 UseCaseMock.staticMock.stubbingContext.sourceLocation = newValue275 }276 }277 public enum InitializerProxy {278 public static func initialize(`restApi`: iOSMockingBird.RestAPI, __file: StaticString = #file, __line: UInt = #line) -> UseCaseMock {279 let mock: UseCaseMock = UseCaseMock(restApi: `restApi`)280 mock.sourceLocation = SourceLocation(__file, __line)281 return mock282 }283 }284 // MARK: Mocked `get`()285 public override func `get`() -> AnyPublisher<[String], URLError> {286 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`get`() -> AnyPublisher<[String], URLError>", arguments: [])287 mockingContext.didInvoke(invocation)288 let implementation = stubbingContext.implementation(for: invocation, optional: false)289 if let concreteImplementation = implementation as? () -> AnyPublisher<[String], URLError> {290 return concreteImplementation()291 } else {292 return (implementation as! () -> AnyPublisher<[String], URLError>)()293 }294 }295 public func `get`() -> Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> AnyPublisher<[String], URLError>, AnyPublisher<[String], URLError>> {296 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`get`() -> AnyPublisher<[String], URLError>", arguments: [])297 return Mockingbird.Mockable<Mockingbird.MethodDeclaration, () -> AnyPublisher<[String], URLError>, AnyPublisher<[String], URLError>>(mock: self, invocation: invocation)298 }299 // MARK: Mocked init(`restApi`: iOSMockingBird.RestAPI)300 public required override init(`restApi`: iOSMockingBird.RestAPI) {301 super.init(restApi: `restApi`)302 Mockingbird.checkVersion(for: self)303 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "init(`restApi`: iOSMockingBird.RestAPI) ", arguments: [Mockingbird.ArgumentMatcher(`restApi`)])304 mockingContext.didInvoke(invocation)305 }306}307/// Initialize an initializable class mock of `iOSMockingBird.UseCase`.308public func mock(_ type: iOSMockingBird.UseCase.Type, file: StaticString = #file, line: UInt = #line) -> UseCaseMock.InitializerProxy.Type {309 return UseCaseMock.InitializerProxy.self310}...
UseCaseInject.generated.swift
Source:UseCaseInject.generated.swift
...34 // MARK: Mocked foo35 override public var `foo`: UseCaseInject.Foo {36 get {37 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "foo.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))38 return self.mockingContext.didInvoke(invocation) { () -> UseCaseInject.Foo in39 let implementation = self.stubbingContext.implementation(for: invocation)40 if let concreteImplementation = implementation as? () -> UseCaseInject.Foo {41 return concreteImplementation()42 } else if let defaultValue = self.stubbingContext.defaultValueProvider.provideValue(for: (UseCaseInject.Foo).self) {43 return defaultValue44 } else {45 fatalError(self.stubbingContext.failTest(for: invocation))46 }47 }48 }49 set {50 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "foo.set", arguments: [ArgumentMatcher(newValue)], returnType: Swift.ObjectIdentifier(Void.self))51 self.mockingContext.didInvoke(invocation)52 let implementation = self.stubbingContext.implementation(for: invocation)53 if let concreteImplementation = implementation as? (UseCaseInject.Foo) -> Void {54 concreteImplementation(newValue)55 } else {56 (implementation as? () -> Void)?()57 }58 }59 }60 public func getFoo() -> Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo> {61 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "foo.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))62 return Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo>(mock: self, invocation: invocation)63 }64 public func setFoo(_ newValue: @escaping @autoclosure () -> UseCaseInject.Foo) -> Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void> {65 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(newValue)]66 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "foo.set", arguments: arguments, returnType: Swift.ObjectIdentifier(Void.self))67 return Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void>(mock: self, invocation: invocation)68 }69 // MARK: Mocked fooCustomInit70 override public var `fooCustomInit`: UseCaseInject.Foo {71 get {72 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooCustomInit.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))73 return self.mockingContext.didInvoke(invocation) { () -> UseCaseInject.Foo in74 let implementation = self.stubbingContext.implementation(for: invocation)75 if let concreteImplementation = implementation as? () -> UseCaseInject.Foo {76 return concreteImplementation()77 } else if let defaultValue = self.stubbingContext.defaultValueProvider.provideValue(for: (UseCaseInject.Foo).self) {78 return defaultValue79 } else {80 fatalError(self.stubbingContext.failTest(for: invocation))81 }82 }83 }84 set {85 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooCustomInit.set", arguments: [ArgumentMatcher(newValue)], returnType: Swift.ObjectIdentifier(Void.self))86 self.mockingContext.didInvoke(invocation)87 let implementation = self.stubbingContext.implementation(for: invocation)88 if let concreteImplementation = implementation as? (UseCaseInject.Foo) -> Void {89 concreteImplementation(newValue)90 } else {91 (implementation as? () -> Void)?()92 }93 }94 }95 public func getFooCustomInit() -> Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo> {96 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooCustomInit.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))97 return Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo>(mock: self, invocation: invocation)98 }99 public func setFooCustomInit(_ newValue: @escaping @autoclosure () -> UseCaseInject.Foo) -> Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void> {100 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(newValue)]101 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooCustomInit.set", arguments: arguments, returnType: Swift.ObjectIdentifier(Void.self))102 return Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void>(mock: self, invocation: invocation)103 }104 // MARK: Mocked fooData105 override public var `fooData`: UseCaseInject.Foo {106 get {107 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooData.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))108 return self.mockingContext.didInvoke(invocation) { () -> UseCaseInject.Foo in109 let implementation = self.stubbingContext.implementation(for: invocation)110 if let concreteImplementation = implementation as? () -> UseCaseInject.Foo {111 return concreteImplementation()112 } else if let defaultValue = self.stubbingContext.defaultValueProvider.provideValue(for: (UseCaseInject.Foo).self) {113 return defaultValue114 } else {115 fatalError(self.stubbingContext.failTest(for: invocation))116 }117 }118 }119 set {120 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooData.set", arguments: [ArgumentMatcher(newValue)], returnType: Swift.ObjectIdentifier(Void.self))121 self.mockingContext.didInvoke(invocation)122 let implementation = self.stubbingContext.implementation(for: invocation)123 if let concreteImplementation = implementation as? (UseCaseInject.Foo) -> Void {124 concreteImplementation(newValue)125 } else {126 (implementation as? () -> Void)?()127 }128 }129 }130 public func getFooData() -> Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo> {131 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooData.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))132 return Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo>(mock: self, invocation: invocation)133 }134 public func setFooData(_ newValue: @escaping @autoclosure () -> UseCaseInject.Foo) -> Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void> {135 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(newValue)]136 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooData.set", arguments: arguments, returnType: Swift.ObjectIdentifier(Void.self))137 return Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void>(mock: self, invocation: invocation)138 }139 // MARK: Mocked fooLazy140 override public var `fooLazy`: UseCaseInject.Foo {141 get {142 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooLazy.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))143 return self.mockingContext.didInvoke(invocation) { () -> UseCaseInject.Foo in144 let implementation = self.stubbingContext.implementation(for: invocation)145 if let concreteImplementation = implementation as? () -> UseCaseInject.Foo {146 return concreteImplementation()147 } else if let defaultValue = self.stubbingContext.defaultValueProvider.provideValue(for: (UseCaseInject.Foo).self) {148 return defaultValue149 } else {150 fatalError(self.stubbingContext.failTest(for: invocation))151 }152 }153 }154 set {155 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooLazy.set", arguments: [ArgumentMatcher(newValue)], returnType: Swift.ObjectIdentifier(Void.self))156 self.mockingContext.didInvoke(invocation)157 let implementation = self.stubbingContext.implementation(for: invocation)158 if let concreteImplementation = implementation as? (UseCaseInject.Foo) -> Void {159 concreteImplementation(newValue)160 } else {161 (implementation as? () -> Void)?()162 }163 }164 }165 public func getFooLazy() -> Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo> {166 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooLazy.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo).self))167 return Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo, UseCaseInject.Foo>(mock: self, invocation: invocation)168 }169 public func setFooLazy(_ newValue: @escaping @autoclosure () -> UseCaseInject.Foo) -> Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void> {170 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(newValue)]171 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooLazy.set", arguments: arguments, returnType: Swift.ObjectIdentifier(Void.self))172 return Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo) -> Void, Void>(mock: self, invocation: invocation)173 }174 // MARK: Mocked fooOptional175 override public var `fooOptional`: UseCaseInject.Foo? {176 get {177 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooOptional.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo?).self))178 return self.mockingContext.didInvoke(invocation) { () -> UseCaseInject.Foo? in179 let implementation = self.stubbingContext.implementation(for: invocation)180 if let concreteImplementation = implementation as? () -> UseCaseInject.Foo? {181 return concreteImplementation()182 } else if let defaultValue = self.stubbingContext.defaultValueProvider.provideValue(for: (UseCaseInject.Foo?).self) {183 return defaultValue184 } else {185 fatalError(self.stubbingContext.failTest(for: invocation))186 }187 }188 }189 set {190 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooOptional.set", arguments: [ArgumentMatcher(newValue)], returnType: Swift.ObjectIdentifier(Void.self))191 self.mockingContext.didInvoke(invocation)192 let implementation = self.stubbingContext.implementation(for: invocation)193 if let concreteImplementation = implementation as? (UseCaseInject.Foo?) -> Void {194 concreteImplementation(newValue)195 } else {196 (implementation as? () -> Void)?()197 }198 }199 }200 public func getFooOptional() -> Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo?, UseCaseInject.Foo?> {201 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooOptional.get", arguments: [], returnType: Swift.ObjectIdentifier((UseCaseInject.Foo?).self))202 return Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> UseCaseInject.Foo?, UseCaseInject.Foo?>(mock: self, invocation: invocation)203 }204 public func setFooOptional(_ newValue: @escaping @autoclosure () -> UseCaseInject.Foo?) -> Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo?) -> Void, Void> {205 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(newValue)]206 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "fooOptional.set", arguments: arguments, returnType: Swift.ObjectIdentifier(Void.self))207 return Mockingbird.Mockable<Mockingbird.PropertySetterDeclaration, (UseCaseInject.Foo?) -> Void, Void>(mock: self, invocation: invocation)208 }209 // MARK: Mocked init()210 public required override init() {211 super.init()212 Mockingbird.checkVersion(for: self)213 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "init() ", arguments: [], returnType: Swift.ObjectIdentifier((Void).self))214 self.mockingContext.didInvoke(invocation)215 }216}217/// Returns an abstract mock which should be initialized using `mock(Bar.self).initialize(â¦)`.218public func mock(_ type: UseCaseInject.Bar.Type, file: StaticString = #file, line: UInt = #line) -> BarMock.InitializerProxy.Type {219 return BarMock.InitializerProxy.self220}221// MARK: - Mocked Foo222public final class FooMock: UseCaseInject.Foo, Mockingbird.Mock {223 static let staticMock = Mockingbird.StaticMock()224 public let mockingContext = Mockingbird.MockingContext()225 public let stubbingContext = Mockingbird.StubbingContext()226 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.14.1", "module_name": "UseCaseInject"])227 public var sourceLocation: Mockingbird.SourceLocation? {228 get { return self.stubbingContext.sourceLocation }229 set {230 self.stubbingContext.sourceLocation = newValue231 FooMock.staticMock.stubbingContext.sourceLocation = newValue232 }233 }234 public enum InitializerProxy {235 public static func initialize(`from` `decoder`: Decoder, __file: StaticString = #file, __line: UInt = #line) throws -> FooMock {236 let mock: FooMock = try FooMock(from: `decoder`)237 mock.sourceLocation = SourceLocation(__file, __line)238 return mock239 }240 public static func initialize(`info`: String, __file: StaticString = #file, __line: UInt = #line) -> FooMock {241 let mock: FooMock = FooMock(info: `info`)242 mock.sourceLocation = SourceLocation(__file, __line)243 return mock244 }245 }246 // MARK: Mocked init(`from` `decoder`: Decoder)247 public required init(`from` `decoder`: Decoder) throws {248 try super.init(from: `decoder`)249 Mockingbird.checkVersion(for: self)250 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "init(`from` `decoder`: Decoder) throws ", arguments: [Mockingbird.ArgumentMatcher(`decoder`)], returnType: Swift.ObjectIdentifier((Void).self))251 self.mockingContext.didInvoke(invocation)252 }253 // MARK: Mocked init(`info`: String)254 public required override init(`info`: String) {255 super.init(info: `info`)256 Mockingbird.checkVersion(for: self)257 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "init(`info`: String) ", arguments: [Mockingbird.ArgumentMatcher(`info`)], returnType: Swift.ObjectIdentifier((Void).self))258 self.mockingContext.didInvoke(invocation)259 }260}261/// Returns an abstract mock which should be initialized using `mock(Foo.self).initialize(â¦)`.262public func mock(_ type: UseCaseInject.Foo.Type, file: StaticString = #file, line: UInt = #line) -> FooMock.InitializerProxy.Type {263 return FooMock.InitializerProxy.self264}265// MARK: - Mocked NetworkServicable266public final class NetworkServicableMock: UseCaseInject.NetworkServicable, Mockingbird.Mock {267 static let staticMock = Mockingbird.StaticMock()268 public let mockingContext = Mockingbird.MockingContext()269 public let stubbingContext = Mockingbird.StubbingContext()270 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.14.1", "module_name": "UseCaseInject"])271 public var sourceLocation: Mockingbird.SourceLocation? {272 get { return self.stubbingContext.sourceLocation }273 set {274 self.stubbingContext.sourceLocation = newValue275 NetworkServicableMock.staticMock.stubbingContext.sourceLocation = newValue276 }277 }278 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {279 Mockingbird.checkVersion(for: self)280 self.sourceLocation = sourceLocation281 }282 // MARK: Mocked `fetch`()283 public func `fetch`() -> Void {284 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`fetch`() -> Void", arguments: [], returnType: Swift.ObjectIdentifier((Void).self))285 self.mockingContext.didInvoke(invocation) { () -> Void in286 let implementation = self.stubbingContext.implementation(for: invocation)287 if let concreteImplementation = implementation as? () -> Void {288 concreteImplementation()289 }290 }291 }292 public func `fetch`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> Void, Void> {293 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`fetch`() -> Void", arguments: [], returnType: Swift.ObjectIdentifier((Void).self))294 return Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> Void, Void>(mock: self, invocation: invocation)295 }296}297/// Returns a concrete mock of `NetworkServicable`.298public func mock(_ type: UseCaseInject.NetworkServicable.Protocol, file: StaticString = #file, line: UInt = #line) -> NetworkServicableMock {299 return NetworkServicableMock(sourceLocation: Mockingbird.SourceLocation(file, line))300}301// MARK: - Mocked NetworkService302public final class NetworkServiceMock: UseCaseInject.NetworkService, Mockingbird.Mock {303 static let staticMock = Mockingbird.StaticMock()304 public let mockingContext = Mockingbird.MockingContext()305 public let stubbingContext = Mockingbird.StubbingContext()306 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.14.1", "module_name": "UseCaseInject"])307 public var sourceLocation: Mockingbird.SourceLocation? {308 get { return self.stubbingContext.sourceLocation }309 set {310 self.stubbingContext.sourceLocation = newValue311 NetworkServiceMock.staticMock.stubbingContext.sourceLocation = newValue312 }313 }314 public enum InitializerProxy {315 public static func initialize(__file: StaticString = #file, __line: UInt = #line) -> NetworkServiceMock {316 let mock: NetworkServiceMock = NetworkServiceMock()317 mock.sourceLocation = SourceLocation(__file, __line)318 return mock319 }320 }321 // MARK: Mocked `fetch`()322 public override func `fetch`() -> Void {323 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`fetch`() -> Void", arguments: [], returnType: Swift.ObjectIdentifier((Void).self))324 self.mockingContext.didInvoke(invocation) { () -> Void in325 let implementation = self.stubbingContext.implementation(for: invocation)326 if let concreteImplementation = implementation as? () -> Void {327 concreteImplementation()328 }329 }330 }331 public func `fetch`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> Void, Void> {332 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`fetch`() -> Void", arguments: [], returnType: Swift.ObjectIdentifier((Void).self))333 return Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> Void, Void>(mock: self, invocation: invocation)334 }335 // MARK: Mocked init()336 public required override init() {337 super.init()338 Mockingbird.checkVersion(for: self)339 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "init() ", arguments: [], returnType: Swift.ObjectIdentifier((Void).self))340 self.mockingContext.didInvoke(invocation)341 }342}343/// Returns an abstract mock which should be initialized using `mock(NetworkService.self).initialize(â¦)`.344public func mock(_ type: UseCaseInject.NetworkService.Type, file: StaticString = #file, line: UInt = #line) -> NetworkServiceMock.InitializerProxy.Type {345 return NetworkServiceMock.InitializerProxy.self346}...
didInvoke
Using AI Code Generation
1class MockingContext {2 func didInvoke() {3 }4}5class MockingContext {6 func didInvoke() {7 }8}9class MockingContext {10 func didInvoke() {11 }12}13class MockingContext {14 func didInvoke() {15 }16}17class MockingContext {18 func didInvoke() {19 }20}21class MockingContext {22 func didInvoke() {23 }24}25class MockingContext {26 func didInvoke() {27 }28}29class MockingContext {
didInvoke
Using AI Code Generation
1let mock = MockingContext()2mock.didInvoke("foo", withArgs: 1, 2, 3)3let mock = MockingContext()4mock.didInvoke("foo", withArgs: 1, 2, 3)5let mock = MockingContext()6mock.didInvoke("foo", withArgs: 1, 2, 3)7let mock = MockingContext()8mock.didInvoke("foo", withArgs: 1, 2, 3)9let mock = MockingContext()10mock.didInvoke("foo", withArgs: 1, 2, 3)11let mock = MockingContext()12mock.didInvoke("foo", withArgs: 1, 2, 3)13let mock = MockingContext()14mock.didInvoke("foo", withArgs: 1, 2, 3)15let mock = MockingContext()16mock.didInvoke("foo", withArgs: 1, 2, 3)17let mock = MockingContext()18mock.didInvoke("foo", withArgs: 1, 2, 3)19let mock = MockingContext()20mock.didInvoke("foo", withArgs: 1, 2, 3)21let mock = MockingContext()22mock.didInvoke("foo", withArgs: 1, 2, 3)
didInvoke
Using AI Code Generation
1var context = MockingContext()2context.didInvoke = {3 print("didInvoke called")4}5context.didInvoke()6var context = MockingContext()7context.didInvoke = {8 print("didInvoke called")9}10context.didInvoke()
didInvoke
Using AI Code Generation
1import XCTest2@testable import SwiftMocking3class MockingContextTest: XCTestCase {4 func testDidInvoke() {5 let context = MockingContext()6 context.didInvoke("foo")7 XCTAssertTrue(context.didInvoke("foo"))8 XCTAssertFalse(context.didInvoke("bar"))9 }10}11import Foundation12class MockingContext {13 func didInvoke(_ name: String) -> Bool {14 return invocations.contains(name)15 }16}17import XCTest18@testable import SwiftMocking19class MockingContextTest: XCTestCase {20 func testDidInvoke() {21 let context = MockingContext()22 context.didInvoke("foo")23 XCTAssertTrue(context.didInvoke("foo"))24 XCTAssertFalse(context.didInvoke("bar"))25 }26}27import Foundation28class MockingContext {29 func didInvoke(_ name: String) -> Bool {30 return invocations.contains(name)31 }32}33import XCTest34@testable import SwiftMocking35class MockingContextTest: XCTestCase {36 func testDidInvoke() {37 let context = MockingContext()38 context.didInvoke("foo")39 XCTAssertTrue(context.didInvoke("foo"))40 XCTAssertFalse(context.didInvoke("bar"))41 }42}43import Foundation44class MockingContext {45 func didInvoke(_ name: String) -> Bool {46 return invocations.contains(name)47 }48}49import XCTest50@testable import SwiftMocking51class MockingContextTest: XCTestCase {52 func testDidInvoke() {53 let context = MockingContext()54 context.didInvoke("foo")55 XCTAssertTrue(context.didInvoke("foo"))56 XCTAssertFalse(context.didInvoke("bar"))57 }58}59import Foundation60class MockingContext {61 func didInvoke(_ name: String
didInvoke
Using AI Code Generation
1let mock = MockingContext()2mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in3}4let result = mock.add(1, 2)5let mock = MockingContext()6mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in7}8let result = mock.add(1, 2)9let mock = MockingContext()10mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in11}12let result = mock.add(1, 2)13let mock = MockingContext()14mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in15}16let result = mock.add(1, 2)17let mock = MockingContext()18mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in19}20let result = mock.add(1, 2)21let mock = MockingContext()22mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in23}24let result = mock.add(1, 2)25let mock = MockingContext()26mock.didInvoke("add", withArgs: 1, 2) { (args) -> Any? in27}
didInvoke
Using AI Code Generation
1class MockingContext {2 var invokedMethodParameters: (method: String, Void)?3 var invokedMethodParametersList = [(method: String, Void)]()4 func didInvoke(method: String) {5 self.invokedMethodParameters = (method, ())6 self.invokedMethodParametersList.append((method, ()))7 }8}9class MockingContext {10 var invokedMethodParameters: (method: String, Void)?11 var invokedMethodParametersList = [(method: String, Void)]()12 func didInvoke(method: String) {13 self.invokedMethodParameters = (method, ())14 self.invokedMethodParametersList.append((method, ()))15 }16}17class MockingContext {18 var invokedMethodParameters: (method: String, Void)?19 var invokedMethodParametersList = [(method: String, Void)]()20 func didInvoke(method: String) {21 self.invokedMethodParameters = (method, ())22 self.invokedMethodParametersList.append((method, ()))23 }24}25class MockingContext {26 var invokedMethodParameters: (method: String, Void)?27 var invokedMethodParametersList = [(method: String, Void)]()28 func didInvoke(method: String) {29 self.invokedMethodParameters = (method, ())30 self.invokedMethodParametersList.append((method
didInvoke
Using AI Code Generation
1let context = MockingContext()2let mock = Mock()3mock.didInvoke = { (method, args) in4 print("Method: \(method)")5 print("Arguments: \(args)")6}7context.mocks[0].method1()8context.mocks[0].method2("abc")9context.mocks[0].method3(1, "abc")10context.mocks[0].method4(1, "abc", 2.0)11context.mocks[0].method5(1, "abc", 2.0, true)12let context = MockingContext()13let mock = Mock()14mock.didInvoke = { (method, args) in15 print("Method: \(method)")16 print("Arguments: \(args)")17}18mock.method1()19mock.method2("abc")20mock.method3(1, "abc")21mock.method4(1, "abc", 2.0)22mock.method5(1, "abc", 2.0, true)23let context = MockingContext()24let mock = Mock()25mock.didInvoke = { (method, args) in26 print("Method: \(method)")27 print("Arguments: \(args)")28}29mock.method1()30mock.method2("abc")31mock.method3(1, "abc")
didInvoke
Using AI Code Generation
1import XCTest2@testable import MyFramework3class MyFrameworkTests: XCTestCase {4 func testExample() {5 let mock = MockingContext()6 mock.expectation(for: #selector(mock.didInvoke))7 mock.doSomething()8 mock.verify()9 }10}11import XCTest12import MyFramework13class MockingContext: MyFramework {14 func expectation(for selector: Selector) {15 expectation = self.expectation(for: selector, object: nil, handler: nil)16 }17 func verify() {18 waitForExpectations(timeout: 0.01, handler: nil)19 }20 override func doSomething() {21 super.doSomething()22 didInvoke()23 }24 @objc func didInvoke() {25 expectation?.fulfill()26 }27}28import XCTest29import MyFramework30class MyFrameworkTests: XCTestCase {31 func testExample() {32 let mock = MockingContext()33 mock.expectation(for: #selector(mock.didInvoke))34 mock.doSomething()35 mock.verify()36 }37}38import XCTest39import MyFramework40class MockingContext: MyFramework {41 func expectation(for selector: Selector) {42 expectation = self.expectation(for: selector, object: nil, handler: nil)43 }44 func verify() {45 waitForExpectations(timeout: 0.01, handler: nil)46 }47 override func doSomething() {48 super.doSomething()49 didInvoke()50 }51 @objc func didInvoke() {52 expectation?.fulfill()53 }54}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!