How to use implementation method of StubbingContext class

Best Mockingbird code snippet using StubbingContext.implementation

NimbleSurveyMocks.generated.swift

Source:NimbleSurveyMocks.generated.swift Github

copy

Full Screen

...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 {767 return UserServiceMock(sourceLocation: SourceLocation(file, line))768}...

Full Screen

Full Screen

iOSMockingBirdMocks.generated.swift

Source:iOSMockingBirdMocks.generated.swift Github

copy

Full Screen

...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}...

Full Screen

Full Screen

DomainTests-DomainMocks.generated.swift

Source:DomainTests-DomainMocks.generated.swift Github

copy

Full Screen

...56 // MARK: Mocked `personExists`(`id`: String)57 public func `personExists`(`id`: String) -> Bool {58 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`personExists`(`id`: String) -> Bool", arguments: [Mockingbird.ArgumentMatcher(`id`)], returnType: Swift.ObjectIdentifier((Bool).self))59 return self.mockingContext.didInvoke(invocation) { () -> Bool in60 let implementation = self.stubbingContext.implementation(for: invocation)61 if let concreteImplementation = implementation as? (String) -> Bool {62 return concreteImplementation(`id`)63 } else if let concreteImplementation = implementation as? () -> Bool {64 return concreteImplementation()65 } else if let defaultValue = self.stubbingContext.defaultValueProvider.provideValue(for: (Bool).self) {66 return defaultValue67 } else {68 fatalError(self.stubbingContext.failTest(for: invocation))69 }70 }71 }72 public func `personExists`(`id`: @escaping @autoclosure () -> String) -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, (String) -> Bool, Bool> {73 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`id`)]74 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`personExists`(`id`: String) -> Bool", arguments: arguments, returnType: Swift.ObjectIdentifier((Bool).self))75 return Mockingbird.Mockable<Mockingbird.FunctionDeclaration, (String) -> Bool, Bool>(mock: self, invocation: invocation)76 }77 // MARK: Mocked `savePerson`(`person`: Domain.Person)78 public func `savePerson`(`person`: Domain.Person) -> Void {79 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`savePerson`(`person`: Domain.Person) -> Void", arguments: [Mockingbird.ArgumentMatcher(`person`)], returnType: Swift.ObjectIdentifier((Void).self))80 self.mockingContext.didInvoke(invocation) { () -> Void in81 let implementation = self.stubbingContext.implementation(for: invocation)82 if let concreteImplementation = implementation as? (Domain.Person) -> Void {83 concreteImplementation(`person`)84 } else if let concreteImplementation = implementation as? () -> Void {85 concreteImplementation()86 }87 }88 }89 public func `savePerson`(`person`: @escaping @autoclosure () -> Domain.Person) -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, (Domain.Person) -> Void, Void> {90 let arguments: [Mockingbird.ArgumentMatcher] = [Mockingbird.resolve(`person`)]91 let invocation: Mockingbird.Invocation = Mockingbird.Invocation(selectorName: "`savePerson`(`person`: Domain.Person) -> Void", arguments: arguments, returnType: Swift.ObjectIdentifier((Void).self))92 return Mockingbird.Mockable<Mockingbird.FunctionDeclaration, (Domain.Person) -> Void, Void>(mock: self, invocation: invocation)93 }94}95/// Returns a concrete mock of `PersonRepository`.96public func mock(_ type: Domain.PersonRepository.Protocol, file: StaticString = #file, line: UInt = #line) -> PersonRepositoryMock {97 return PersonRepositoryMock(sourceLocation: Mockingbird.SourceLocation(file, line))98}...

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

1let stubbingContext = StubbingContext()2stubbingContext.implementation()3let stubbingContext = StubbingContext()4stubbingContext.implementation()5let stubbingContext = StubbingContext()6stubbingContext.implementation()7let stubbingContext = StubbingContext()8stubbingContext.implementation()9let stubbingContext = StubbingContext()10stubbingContext.implementation()11let stubbingContext = StubbingContext()12stubbingContext.implementation()13let stubbingContext = StubbingContext()14stubbingContext.implementation()15let stubbingContext = StubbingContext()16stubbingContext.implementation()17let stubbingContext = StubbingContext()18stubbingContext.implementation()19let stubbingContext = StubbingContext()20stubbingContext.implementation()21let stubbingContext = StubbingContext()22stubbingContext.implementation()23let stubbingContext = StubbingContext()24stubbingContext.implementation()25let stubbingContext = StubbingContext()26stubbingContext.implementation()27let stubbingContext = StubbingContext()28stubbingContext.implementation()29let stubbingContext = StubbingContext()30stubbingContext.implementation()

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

1let stubbingContext = StubbingContext()2stubbingContext.stubbingMethod()3let stubbingContext = StubbingContext()4stubbingContext.stubbingMethod()5let stubbingContext = StubbingContext()6stubbingContext.stubbingMethod()7let stubbingContext = StubbingContext()8stubbingContext.stubbingMethod()9let stubbingContext = StubbingContext()10stubbingContext.stubbingMethod()11let stubbingContext = StubbingContext()12stubbingContext.stubbingMethod()13let stubbingContext = StubbingContext()14stubbingContext.stubbingMethod()15let stubbingContext = StubbingContext()16stubbingContext.stubbingMethod()17let stubbingContext = StubbingContext()18stubbingContext.stubbingMethod()19let stubbingContext = StubbingContext()20stubbingContext.stubbingMethod()21let stubbingContext = StubbingContext()22stubbingContext.stubbingMethod()23let stubbingContext = StubbingContext()24stubbingContext.stubbingMethod()25let stubbingContext = StubbingContext()26stubbingContext.stubbingMethod()27let stubbingContext = StubbingContext()28stubbingContext.stubbingMethod()

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

1import Foundation2class StubbingContext {3 func stubbingContext() {4 print("stubbingContext")5 }6}7import Foundation8class StubbingContext {9 func stubbingContext() {10 print("stubbingContext")11 }12}13import Foundation14class StubbingContext {15 func stubbingContext() {16 print("stubbingContext")17 }18}19import Foundation20class StubbingContext {21 func stubbingContext() {22 print("stubbingContext")23 }24}25import Foundation26class StubbingContext {27 func stubbingContext() {28 print("stubbingContext")29 }30}31import Foundation32class StubbingContext {33 func stubbingContext() {34 print("stubbingContext")35 }36}37import Foundation38class StubbingContext {39 func stubbingContext() {40 print("stubbingContext")41 }42}43import Foundation44class StubbingContext {45 func stubbingContext() {46 print("stubbingContext")47 }48}49import Foundation50class StubbingContext {51 func stubbingContext() {52 print("stubbingContext")53 }54}55import Foundation56class StubbingContext {57 func stubbingContext() {58 print("stubbingContext")59 }60}61import Foundation62class StubbingContext {63 func stubbingContext() {64 print("stubbingContext")65 }66}67import Foundation68class StubbingContext {69 func stubbingContext()

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

1func testExample() {2 let stubbingContext = StubbingContext()3 let stubbedValue = stubbingContext.stubbedValue()4 print(stubbedValue)5}6func testExample() {7 let stubbedValue = StubbedValue()8 let value = stubbedValue.value()9 print(value)10}11func testExample() {12 let stubbedValue = StubbedValue()13 let value = stubbedValue.value()14 print(value)15}16func testExample() {17 let stubbedValue = StubbedValue()18 let value = stubbedValue.value()19 print(value)20}21func testExample() {22 let stubbedValue = StubbedValue()23 let value = stubbedValue.value()24 print(value)25}26func testExample() {27 let stubbedValue = StubbedValue()28 let value = stubbedValue.value()29 print(value)30}31func testExample() {32 let stubbedValue = StubbedValue()33 let value = stubbedValue.value()34 print(value)35}36func testExample() {37 let stubbedValue = StubbedValue()38 let value = stubbedValue.value()39 print(value)40}41func testExample() {42 let stubbedValue = StubbedValue()43 let value = stubbedValue.value()44 print(value)45}46func testExample() {47 let stubbedValue = StubbedValue()48 let value = stubbedValue.value()49 print(value)50}51func testExample() {

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

1let stubbingContext = StubbingContext()2stubbingContext.stubMethod()3let stubbingContext = StubbingContext()4stubbingContext.stubMethod()5let stubbingContext = StubbingContext()6stubbingContext.stubMethod()7let stubbingContext = StubbingContext()8stubbingContext.stubMethod()9let stubbingContext = StubbingContext()10stubbingContext.stubMethod()11let stubbingContext = StubbingContext()12stubbingContext.stubMethod()13let stubbingContext = StubbingContext()14stubbingContext.stubMethod()15let stubbingContext = StubbingContext()16stubbingContext.stubMethod()17let stubbingContext = StubbingContext()18stubbingContext.stubMethod()19let stubbingContext = StubbingContext()20stubbingContext.stubMethod()21let stubbingContext = StubbingContext()22stubbingContext.stubMethod()23let stubbingContext = StubbingContext()24stubbingContext.stubMethod()

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

1let mock = MockingContext()2 return HTTPStubsResponse(data: Data(), statusCode: 200, headers: nil)3}4let mock = MockingContext()5 return HTTPStubsResponse(data: Data(), statusCode: 200, headers: nil)6}

Full Screen

Full Screen

implementation

Using AI Code Generation

copy

Full Screen

11. StubbingContext.stubbingContext().stub("getQuote", with: "StubbingContext")22. let quote = StubbingContext.stubbingContext().getQuote()33. print(quote)41. let stubbingContext = StubbingContext()52. stubbingContext.stub("getQuote", with: "StubbingContext")63. let quote = stubbingContext.getQuote()74. print(quote)81. let stubbingContext = StubbingContext()92. stubbingContext.stub("getQuote", with: "StubbingContext")103. let quote = stubbingContext.getQuote()114. print(quote)121. let stubbingContext = StubbingContext()132. stubbingContext.stub("getQuote", with: "StubbingContext")143. let quote = stubbingContext.getQuote()154. print(quote)161. let stubbingContext = StubbingContext()172. stubbingContext.stub("getQuote", with: "StubbingContext")183. let quote = stubbingContext.getQuote()194. print(quote)201. let stubbingContext = StubbingContext()212. stubbingContext.stub("getQuote", with: "StubbingContext")223. let quote = stubbingContext.getQuote()234. print(quote)241. let stubbingContext = StubbingContext()252. stubbingContext.stub("getQuote", with: "StubbingContext")263. let quote = stubbingContext.getQuote()274. print(quote)281. let stubbingContext = StubbingContext()292. stubbingContext.stub("getQuote", with: "StubbingContext")303. let quote = stubbingContext.getQuote()314. print(quote)

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Mockingbird automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in StubbingContext

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful