How to use MockingContext class

Best Mockingbird code snippet using MockingContext

NimbleSurveyMocks.generated.swift

Source:NimbleSurveyMocks.generated.swift Github

copy

Full Screen

...24private var genericTypesStaticMocks = Mockingbird.Synchronized<[String: Mockingbird.StaticMock]>([:])25// MARK: - Mocked ApiService26public final class ApiServiceMock: NimbleSurvey.ApiService, Mockingbird.Mock {27 static let staticMock = Mockingbird.StaticMock()28 public let mockingContext = Mockingbird.MockingContext()29 public let stubbingContext = Mockingbird.StubbingContext()30 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.10.0", "module_name": "NimbleSurvey"])31 public var sourceLocation: Mockingbird.SourceLocation? {32 get { return stubbingContext.sourceLocation }33 set {34 stubbingContext.sourceLocation = newValue35 ApiServiceMock.staticMock.stubbingContext.sourceLocation = newValue36 }37 }38 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {39 Mockingbird.checkVersion(for: self)40 self.sourceLocation = sourceLocation41 }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`()...

Full Screen

Full Screen

iOSMockingBirdMocks.generated.swift

Source:iOSMockingBirdMocks.generated.swift Github

copy

Full Screen

...15private var genericTypesStaticMocks = Mockingbird.Synchronized<[String: Mockingbird.StaticMock]>([:])16// MARK: - Mocked AppDelegate17public final class AppDelegateMock: iOSMockingBird.AppDelegate, Mockingbird.Mock {18 static let staticMock = Mockingbird.StaticMock()19 public let mockingContext = Mockingbird.MockingContext()20 public let stubbingContext = Mockingbird.StubbingContext()21 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.11.1", "module_name": "iOSMockingBird"])22 public var sourceLocation: Mockingbird.SourceLocation? {23 get { return stubbingContext.sourceLocation }24 set {25 stubbingContext.sourceLocation = newValue26 AppDelegateMock.staticMock.stubbingContext.sourceLocation = newValue27 }28 }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 mock...

Full Screen

Full Screen

DomainTests-DomainMocks.generated.swift

Source:DomainTests-DomainMocks.generated.swift Github

copy

Full Screen

...12private var genericTypesStaticMocks = Mockingbird.Synchronized<[String: Mockingbird.StaticMock]>([:])13// MARK: - Mocked AuthUser14public final class AuthUserMock: Domain.AuthUser, Mockingbird.Mock {15 static let staticMock = Mockingbird.StaticMock()16 public let mockingContext = Mockingbird.MockingContext()17 public let stubbingContext = Mockingbird.StubbingContext()18 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.16.0", "module_name": "Domain"])19 public var sourceLocation: Mockingbird.SourceLocation? { get { fatalError("See 'Thunk Pruning' in the README") } set { fatalError("See 'Thunk Pruning' in the README") } }20 public enum InitializerProxy {21 public static func initialize(`userId`: String, `password`: String, `roles`: Array<Domain.Role>, __file: StaticString = #file, __line: UInt = #line) throws -> AuthUserMock { fatalError("See 'Thunk Pruning' in the README") }22 }23 // MARK: Mocked `getRoles`()24 public override func `getRoles`() -> Array<Domain.Role> { fatalError("See 'Thunk Pruning' in the README") }25 public func `getRoles`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> Array<Domain.Role>, Array<Domain.Role>> { fatalError("See 'Thunk Pruning' in the README") }26 // MARK: Mocked `getPassword`()27 public override func `getPassword`() -> String { fatalError("See 'Thunk Pruning' in the README") }28 public func `getPassword`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> String, String> { fatalError("See 'Thunk Pruning' in the README") }29 // MARK: Mocked `getUserId`()30 public override func `getUserId`() -> String { fatalError("See 'Thunk Pruning' in the README") }31 public func `getUserId`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> String, String> { fatalError("See 'Thunk Pruning' in the README") }32 // MARK: Mocked init(`userId`: String, `password`: String, `roles`: Array<Domain.Role>)33 public required override init(`userId`: String, `password`: String, `roles`: Array<Domain.Role>) throws { fatalError("See 'Thunk Pruning' in the README") }34}35/// Returns an abstract mock which should be initialized using `mock(AuthUser.self).initialize(…)`.36public func mock(_ type: Domain.AuthUser.Type, file: StaticString = #file, line: UInt = #line) -> AuthUserMock.InitializerProxy.Type {37 return AuthUserMock.InitializerProxy.self38}39// MARK: - Mocked PersonRepository40public final class PersonRepositoryMock: Domain.PersonRepository, Mockingbird.Mock {41 static let staticMock = Mockingbird.StaticMock()42 public let mockingContext = Mockingbird.MockingContext()43 public let stubbingContext = Mockingbird.StubbingContext()44 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.16.0", "module_name": "Domain"])45 public var sourceLocation: Mockingbird.SourceLocation? {46 get { return self.stubbingContext.sourceLocation }47 set {48 self.stubbingContext.sourceLocation = newValue49 PersonRepositoryMock.staticMock.stubbingContext.sourceLocation = newValue50 }51 }52 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {53 Mockingbird.checkVersion(for: self)54 self.sourceLocation = sourceLocation55 }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}99// MARK: - Mocked PersonService100public final class PersonServiceMock: Domain.PersonService, Mockingbird.Mock {101 static let staticMock = Mockingbird.StaticMock()102 public let mockingContext = Mockingbird.MockingContext()103 public let stubbingContext = Mockingbird.StubbingContext()104 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.16.0", "module_name": "Domain"])105 public var sourceLocation: Mockingbird.SourceLocation? { get { fatalError("See 'Thunk Pruning' in the README") } set { fatalError("See 'Thunk Pruning' in the README") } }106 public enum InitializerProxy {107 public static func initialize(`personRepository`: Domain.PersonRepository, __file: StaticString = #file, __line: UInt = #line) -> PersonServiceMock { fatalError("See 'Thunk Pruning' in the README") }108 }109 // MARK: Mocked `savePerson`(`person`: Domain.Person)110 public override func `savePerson`(`person`: Domain.Person) throws -> Void { fatalError("See 'Thunk Pruning' in the README") }111 public func `savePerson`(`person`: @escaping @autoclosure () -> Domain.Person) -> Mockingbird.Mockable<Mockingbird.ThrowingFunctionDeclaration, (Domain.Person) throws -> Void, Void> { fatalError("See 'Thunk Pruning' in the README") }112 // MARK: Mocked init(`personRepository`: Domain.PersonRepository)113 public required override init(`personRepository`: Domain.PersonRepository) { fatalError("See 'Thunk Pruning' in the README") }114}115/// Returns an abstract mock which should be initialized using `mock(PersonService.self).initialize(…)`.116public func mock(_ type: Domain.PersonService.Type, file: StaticString = #file, line: UInt = #line) -> PersonServiceMock.InitializerProxy.Type {117 return PersonServiceMock.InitializerProxy.self118}119// MARK: - Mocked Person120public final class PersonMock: Domain.Person, Mockingbird.Mock {121 static let staticMock = Mockingbird.StaticMock()122 public let mockingContext = Mockingbird.MockingContext()123 public let stubbingContext = Mockingbird.StubbingContext()124 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.16.0", "module_name": "Domain"])125 public var sourceLocation: Mockingbird.SourceLocation? { get { fatalError("See 'Thunk Pruning' in the README") } set { fatalError("See 'Thunk Pruning' in the README") } }126 public enum InitializerProxy {127 public static func initialize(`id`: String, `name`: String, `authUser`: Domain.AuthUser, __file: StaticString = #file, __line: UInt = #line) throws -> PersonMock { fatalError("See 'Thunk Pruning' in the README") }128 }129 // MARK: Mocked `getAuthUser`()130 public override func `getAuthUser`() -> Domain.AuthUser { fatalError("See 'Thunk Pruning' in the README") }131 public func `getAuthUser`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> Domain.AuthUser, Domain.AuthUser> { fatalError("See 'Thunk Pruning' in the README") }132 // MARK: Mocked `getId`()133 public override func `getId`() -> String { fatalError("See 'Thunk Pruning' in the README") }134 public func `getId`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> String, String> { fatalError("See 'Thunk Pruning' in the README") }135 // MARK: Mocked `getName`()136 public override func `getName`() -> String { fatalError("See 'Thunk Pruning' in the README") }137 public func `getName`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> String, String> { fatalError("See 'Thunk Pruning' in the README") }138 // MARK: Mocked init(`id`: String, `name`: String, `authUser`: Domain.AuthUser)139 public required override init(`id`: String, `name`: String, `authUser`: Domain.AuthUser) throws { fatalError("See 'Thunk Pruning' in the README") }140}141/// Returns an abstract mock which should be initialized using `mock(Person.self).initialize(…)`.142public func mock(_ type: Domain.Person.Type, file: StaticString = #file, line: UInt = #line) -> PersonMock.InitializerProxy.Type {143 return PersonMock.InitializerProxy.self144}145// MARK: - Mocked RoleRepository146public final class RoleRepositoryMock: Domain.RoleRepository, Mockingbird.Mock {147 static let staticMock = Mockingbird.StaticMock()148 public let mockingContext = Mockingbird.MockingContext()149 public let stubbingContext = Mockingbird.StubbingContext()150 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.16.0", "module_name": "Domain"])151 public var sourceLocation: Mockingbird.SourceLocation? { get { fatalError("See 'Thunk Pruning' in the README") } set { fatalError("See 'Thunk Pruning' in the README") } }152 fileprivate init(sourceLocation: Mockingbird.SourceLocation) {153 Mockingbird.checkVersion(for: self)154 self.sourceLocation = sourceLocation155 }156 // MARK: Mocked `getRoles`()157 public func `getRoles`() -> [Domain.Role] { fatalError("See 'Thunk Pruning' in the README") }158 public func `getRoles`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> [Domain.Role], [Domain.Role]> { fatalError("See 'Thunk Pruning' in the README") }159}160/// Returns a concrete mock of `RoleRepository`.161public func mock(_ type: Domain.RoleRepository.Protocol, file: StaticString = #file, line: UInt = #line) -> RoleRepositoryMock {162 return RoleRepositoryMock(sourceLocation: Mockingbird.SourceLocation(file, line))163}164// MARK: - Mocked Role165public final class RoleMock: Domain.Role, Mockingbird.Mock {166 static let staticMock = Mockingbird.StaticMock()167 public let mockingContext = Mockingbird.MockingContext()168 public let stubbingContext = Mockingbird.StubbingContext()169 public let mockMetadata = Mockingbird.MockMetadata(["generator_version": "0.16.0", "module_name": "Domain"])170 public var sourceLocation: Mockingbird.SourceLocation? { get { fatalError("See 'Thunk Pruning' in the README") } set { fatalError("See 'Thunk Pruning' in the README") } }171 public enum InitializerProxy {172 public static func initialize(`name`: String, __file: StaticString = #file, __line: UInt = #line) -> RoleMock { fatalError("See 'Thunk Pruning' in the README") }173 }174 // MARK: Mocked `getName`()175 public override func `getName`() -> String { fatalError("See 'Thunk Pruning' in the README") }176 public func `getName`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> String, String> { fatalError("See 'Thunk Pruning' in the README") }177 // MARK: Mocked `getDescription`()178 public override func `getDescription`() -> String? { fatalError("See 'Thunk Pruning' in the README") }179 public func `getDescription`() -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, () -> String?, String?> { fatalError("See 'Thunk Pruning' in the README") }180 // MARK: Mocked `setDescription`(`description`: String)181 public override func `setDescription`(`description`: String) -> Void { fatalError("See 'Thunk Pruning' in the README") }...

Full Screen

Full Screen

MockingContext

Using AI Code Generation

copy

Full Screen

1import Mockingbird2let mock = MockingContext()3import Mockingbird4let mock = MockingContext()5import Mockingbird6let mock = MockingContext()7import Mockingbird8let mock = MockingContext()9import Mockingbird10let mock = MockingContext()11import Mockingbird12let mock = MockingContext()13import Mockingbird14let mock = MockingContext()15import Mockingbird16let mock = MockingContext()17import Mockingbird18let mock = MockingContext()19import Mockingbird20let mock = MockingContext()21import Mockingbird22let mock = MockingContext()23import Mockingbird24let mock = MockingContext()25import Mockingbird26let mock = MockingContext()27import Mockingbird28let mock = MockingContext()29import Mockingbird30let mock = MockingContext()31import Mockingbird32let mock = MockingContext()

Full Screen

Full Screen

MockingContext

Using AI Code Generation

copy

Full Screen

1import Mockingbird2import XCTest3class MockingContextTests: XCTestCase {4 func testMockingContext() {5 let context = MockingContext()6 let mock = context.mock(for: SomeProtocol.self)7 context.stub(mock.someMethod()).andReturn(1)8 XCTAssertEqual(mock.someMethod(), 1)9 }10}11import Mockingbird12import XCTest13class MockingbirdTests: XCTestCase {14 func testMockingbird() {15 let mock = mock(SomeProtocol.self)16 stub(mock.someMethod()).andReturn(1)17 XCTAssertEqual(mock.someMethod(), 1)18 }19}20import Mockingbird21import XCTest22class MockingbirdTests: XCTestCase {23 func testMockingbird() {24 let mock = mock(SomeProtocol.self)25 stub(mock.someMethod()).andReturn(1)26 XCTAssertEqual(mock.someMethod(), 1)27 }28}29import Mockingbird30import XCTest31class MockingbirdTests: XCTestCase {32 func testMockingbird() {33 let mock = mock(SomeProtocol.self)34 stub(mock.someMethod()).andReturn(1)35 XCTAssertEqual(mock.someMethod(), 1)36 }37}38import Mockingbird39import XCTest40class MockingbirdTests: XCTestCase {41 func testMockingbird() {42 let mock = mock(SomeProtocol.self)43 stub(mock.someMethod()).andReturn(1)44 XCTAssertEqual(mock.someMethod(), 1)45 }46}47import Mockingbird48import XCTest49class MockingbirdTests: XCTestCase {50 func testMockingbird() {51 let mock = mock(SomeProtocol.self)52 stub(mock.someMethod()).andReturn(1)53 XCTAssertEqual(mock.someMethod(), 1)54 }55}56import Mockingbird57import XCTest58class MockingbirdTests: XCTestCase {59 func testMockingbird() {60 let mock = mock(SomeProtocol.self)61 stub(mock.someMethod()).andReturn(1)62 XCTAssertEqual(mock.someMethod(), 1)63 }64}

Full Screen

Full Screen

MockingContext

Using AI Code Generation

copy

Full Screen

1import Mockingbird2import XCTest3class 1: XCTestCase {4 func test() {5 let context = MockingContext()6 let mock = context.mock(1.self)7 }8}9import Mockingbird10import XCTest11class 2: XCTestCase {12 func test() {13 let context = MockingbirdContext()14 let mock = context.mock(2.self)15 }16}17import Mockingbird18import XCTest19class 3: XCTestCase {20 func test() {21 let context = MockingbirdContext()22 let mock = context.mock(3.self)23 }24}25import Mockingbird26import XCTest27class 4: XCTestCase {28 func test() {29 let context = MockingbirdContext()30 let mock = context.mock(4.self)31 }32}33import Mockingbird34import XCTest35class 5: XCTestCase {36 func test() {37 let context = MockingbirdContext()38 let mock = context.mock(5.self)39 }40}41import Mockingbird42import XCTest43class 6: XCTestCase {44 func test() {45 let context = MockingbirdContext()46 let mock = context.mock(6.self)47 }48}49import Mockingbird50import XCTest51class 7: XCTestCase {52 func test() {53 let context = MockingbirdContext()54 let mock = context.mock(7.self)55 }56}57import Mockingbird58import XCTest59class 8: XCTestCase {60 func test() {61 let context = MockingbirdContext()62 let mock = context.mock(8.self)63 }64}65import Mocking

Full Screen

Full Screen

MockingContext

Using AI Code Generation

copy

Full Screen

1import MockingbirdFramework2import XCTest3class MockingContextTests: XCTestCase {4 func testMockingContext() {5 let context = MockingContext()6 let mock = context.mock(MockedProtocol.self)7 context.expect(mock).method("testMethod").andReturn("test")8 let result = mock.testMethod()9 XCTAssertEqual(result, "test")10 context.verify()11 }12}13import MockingbirdFramework14import XCTest15class MockingContextTests: XCTestCase {16 func testMockingContext() {17 let context = MockingContext()18 let mock = context.mock(MockedProtocol.self)19 context.expect(mock).method("testMethod").andReturn("test")20 let result = mock.testMethod()21 XCTAssertEqual(result, "test")22 context.verify()23 }24}25import MockingbirdFramework26import XCTest27class MockingContextTests: XCTestCase {28 func testMockingContext() {29 let context = MockingContext()30 let mock = context.mock(MockedProtocol.self)31 context.expect(mock).method("testMethod").andReturn("test")32 let result = mock.testMethod()33 XCTAssertEqual(result, "test")34 context.verify()35 }36}37import MockingbirdFramework38import XCTest39class MockingContextTests: XCTestCase {40 func testMockingContext() {41 let context = MockingContext()

Full Screen

Full Screen

MockingContext

Using AI Code Generation

copy

Full Screen

1let context = MockingContext()2let mock = context.mock(for: SomeProtocol.self)3let context = MockingContext()4let mock = context.mock(for: SomeProtocol.self)5let context = MockingContext()6let mock = context.mock(for: SomeProtocol.self)7let context = MockingContext()8let mock = context.mock(for: SomeProtocol.self)9let context = MockingContext()10let mock = context.mock(for: SomeProtocol.self)11let context = MockingContext()12let mock = context.mock(for: SomeProtocol.self)13let context = MockingContext()14let mock = context.mock(for: SomeProtocol.self)15let context = MockingContext()16let mock = context.mock(for: SomeProtocol.self)17let context = MockingContext()18let mock = context.mock(for: SomeProtocol.self)19let context = MockingContext()20let mock = context.mock(for: SomeProtocol.self)21let context = MockingContext()22let mock = context.mock(for: SomeProtocol.self)

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful