-
Notifications
You must be signed in to change notification settings - Fork 16
/
AutoMockable.generated.swift
804 lines (681 loc) · 31 KB
/
AutoMockable.generated.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
// Generated using Sourcery 2.0.3 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable all
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
#if canImport(UserNotifications)
import UserNotifications
#endif
import CioInternalCommon
/**
######################################################
Documentation
######################################################
This automatically generated file you are viewing contains mock classes that you can use in your test suite.
* How do you generate a new mock class?
1. Mocks are generated from Swift protocols. So, you must make one.
```
protocol FriendsRepository {
func acceptFriendRequest<Attributes: Encodable>(attributes: Attributes, _ onComplete: @escaping () -> Void)
}
class AppFriendsRepository: FriendsRepository {
...
}
```
2. Have your new protocol extend `AutoMockable`:
```
protocol FriendsRepository: AutoMockable {
func acceptFriendRequest<Attributes: Encodable>(
// sourcery:Type=Encodable
attributes: Attributes,
_ onComplete: @escaping () -> Void)
}
```
> Notice the use of `// sourcery:Type=Encodable` for the generic type parameter. Without this, the mock would
fail to compile: `functionNameReceiveArguments = (Attributes)` because `Attributes` is unknown to this `var`.
Instead, we give the parameter a different type to use for the mock. `Encodable` works in this case.
It will require a cast in the test function code, however.
3. Run the command `make generate` on your machine. The new mock should be added to this file.
* How do you use the mocks in your test class?
```
class ExampleViewModelTest: XCTestCase {
var viewModel: ExampleViewModel!
var exampleRepositoryMock: ExampleRepositoryMock!
override func setUp() {
exampleRepositoryMock = ExampleRepositoryMock()
viewModel = AppExampleViewModel(exampleRepository: exampleRepositoryMock)
}
}
```
Or, you may need to inject the mock in a different way using the DI.shared graph:
```
class ExampleTest: XCTestCase {
var exampleViewModelMock: ExampleViewModelMock!
var example: Example!
override func setUp() {
exampleViewModelMock = ExampleViewModelMock()
DI.shared.override(.exampleViewModel, value: exampleViewModelMock, forType: ExampleViewModel.self)
example = Example()
}
}
```
*/
/**
Class to easily create a mocked version of the `CleanupRepository` class.
This class is equipped with functions and properties ready for you to mock!
Note: This file is automatically generated. This means the mocks should always be up-to-date and has a consistent API.
See the SDK documentation to learn the basics behind using the mock classes in the SDK.
*/
class CleanupRepositoryMock: CleanupRepository, Mock {
/// If *any* interactions done on mock. `true` if any method or property getter/setter called.
var mockCalled: Bool = false //
init() {
Mocks.shared.add(mock: self)
}
public func resetMock() {
cleanupCallsCount = 0
mockCalled = false // do last as resetting properties above can make this true
}
// MARK: - cleanup
/// Number of times the function was called.
private(set) var cleanupCallsCount = 0
/// `true` if the function was ever called.
var cleanupCalled: Bool {
cleanupCallsCount > 0
}
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
var cleanupClosure: (() -> Void)?
/// Mocked function for `cleanup()`. Your opportunity to return a mocked value and check result of mock in test code.
func cleanup() {
mockCalled = true
cleanupCallsCount += 1
cleanupClosure?()
}
}
/**
Class to easily create a mocked version of the `CustomerIOInstance` class.
This class is equipped with functions and properties ready for you to mock!
Note: This file is automatically generated. This means the mocks should always be up-to-date and has a consistent API.
See the SDK documentation to learn the basics behind using the mock classes in the SDK.
*/
public class CustomerIOInstanceMock: CustomerIOInstance, Mock {
/// If *any* interactions done on mock. `true` if any method or property getter/setter called.
public var mockCalled: Bool = false //
public init() {
Mocks.shared.add(mock: self)
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingSiteId: String? = nil
/// `true` if the getter or setter of property is called at least once.
public var siteIdCalled: Bool {
siteIdGetCalled || siteIdSetCalled
}
/// `true` if the getter called on the property at least once.
public var siteIdGetCalled: Bool {
siteIdGetCallsCount > 0
}
public var siteIdGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var siteIdSetCalled: Bool {
siteIdSetCallsCount > 0
}
public var siteIdSetCallsCount = 0
/// The mocked property with a getter and setter.
public var siteId: String? {
get {
mockCalled = true
siteIdGetCallsCount += 1
return underlyingSiteId
}
set(value) {
mockCalled = true
siteIdSetCallsCount += 1
underlyingSiteId = value
}
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingConfig: SdkConfig? = nil
/// `true` if the getter or setter of property is called at least once.
public var configCalled: Bool {
configGetCalled || configSetCalled
}
/// `true` if the getter called on the property at least once.
public var configGetCalled: Bool {
configGetCallsCount > 0
}
public var configGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var configSetCalled: Bool {
configSetCallsCount > 0
}
public var configSetCallsCount = 0
/// The mocked property with a getter and setter.
public var config: SdkConfig? {
get {
mockCalled = true
configGetCallsCount += 1
return underlyingConfig
}
set(value) {
mockCalled = true
configSetCallsCount += 1
underlyingConfig = value
}
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingRegisteredDeviceToken: String? = nil
/// `true` if the getter or setter of property is called at least once.
public var registeredDeviceTokenCalled: Bool {
registeredDeviceTokenGetCalled || registeredDeviceTokenSetCalled
}
/// `true` if the getter called on the property at least once.
public var registeredDeviceTokenGetCalled: Bool {
registeredDeviceTokenGetCallsCount > 0
}
public var registeredDeviceTokenGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var registeredDeviceTokenSetCalled: Bool {
registeredDeviceTokenSetCallsCount > 0
}
public var registeredDeviceTokenSetCallsCount = 0
/// The mocked property with a getter and setter.
public var registeredDeviceToken: String? {
get {
mockCalled = true
registeredDeviceTokenGetCallsCount += 1
return underlyingRegisteredDeviceToken
}
set(value) {
mockCalled = true
registeredDeviceTokenSetCallsCount += 1
underlyingRegisteredDeviceToken = value
}
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingProfileAttributes: [String: Any] = [:]
/// `true` if the getter or setter of property is called at least once.
public var profileAttributesCalled: Bool {
profileAttributesGetCalled || profileAttributesSetCalled
}
/// `true` if the getter called on the property at least once.
public var profileAttributesGetCalled: Bool {
profileAttributesGetCallsCount > 0
}
public var profileAttributesGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var profileAttributesSetCalled: Bool {
profileAttributesSetCallsCount > 0
}
public var profileAttributesSetCallsCount = 0
/// The mocked property with a getter and setter.
public var profileAttributes: [String: Any] {
get {
mockCalled = true
profileAttributesGetCallsCount += 1
return underlyingProfileAttributes
}
set(value) {
mockCalled = true
profileAttributesSetCallsCount += 1
underlyingProfileAttributes = value
}
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingDeviceAttributes: [String: Any] = [:]
/// `true` if the getter or setter of property is called at least once.
public var deviceAttributesCalled: Bool {
deviceAttributesGetCalled || deviceAttributesSetCalled
}
/// `true` if the getter called on the property at least once.
public var deviceAttributesGetCalled: Bool {
deviceAttributesGetCallsCount > 0
}
public var deviceAttributesGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var deviceAttributesSetCalled: Bool {
deviceAttributesSetCallsCount > 0
}
public var deviceAttributesSetCallsCount = 0
/// The mocked property with a getter and setter.
public var deviceAttributes: [String: Any] {
get {
mockCalled = true
deviceAttributesGetCallsCount += 1
return underlyingDeviceAttributes
}
set(value) {
mockCalled = true
deviceAttributesSetCallsCount += 1
underlyingDeviceAttributes = value
}
}
public func resetMock() {
siteId = nil
siteIdGetCallsCount = 0
siteIdSetCallsCount = 0
config = nil
configGetCallsCount = 0
configSetCallsCount = 0
registeredDeviceToken = nil
registeredDeviceTokenGetCallsCount = 0
registeredDeviceTokenSetCallsCount = 0
profileAttributesGetCallsCount = 0
profileAttributesSetCallsCount = 0
deviceAttributesGetCallsCount = 0
deviceAttributesSetCallsCount = 0
identifyCallsCount = 0
identifyReceivedArguments = nil
identifyReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
identifyEncodableReceivedArguments = nil
identifyEncodableReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
clearIdentifyCallsCount = 0
mockCalled = false // do last as resetting properties above can make this true
trackCallsCount = 0
trackReceivedArguments = nil
trackReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
trackEncodableReceivedArguments = nil
trackEncodableReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
screenCallsCount = 0
screenReceivedArguments = nil
screenReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
screenEncodableReceivedArguments = nil
screenEncodableReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
registerDeviceTokenCallsCount = 0
registerDeviceTokenReceivedArguments = nil
registerDeviceTokenReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
deleteDeviceTokenCallsCount = 0
mockCalled = false // do last as resetting properties above can make this true
trackMetricCallsCount = 0
trackMetricReceivedArguments = nil
trackMetricReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
}
// MARK: - identify
/// Number of times the function was called.
public private(set) var identifyCallsCount = 0
/// `true` if the function was ever called.
public var identifyCalled: Bool {
identifyCallsCount > 0
}
/// The arguments from the *last* time the function was called.
public private(set) var identifyReceivedArguments: (identifier: String, body: [String: Any])?
/// Arguments from *all* of the times that the function was called.
public private(set) var identifyReceivedInvocations: [(identifier: String, body: [String: Any])] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var identifyClosure: ((String, [String: Any]) -> Void)?
/// Mocked function for `identify(identifier: String, body: [String: Any])`. Your opportunity to return a mocked value and check result of mock in test code.
public func identify(identifier: String, body: [String: Any]) {
mockCalled = true
identifyCallsCount += 1
identifyReceivedArguments = (identifier: identifier, body: body)
identifyReceivedInvocations.append((identifier: identifier, body: body))
identifyClosure?(identifier, body)
}
// MARK: - identify<RequestBody: Encodable>
/// The arguments from the *last* time the function was called.
public private(set) var identifyEncodableReceivedArguments: (identifier: String, body: AnyEncodable)?
/// Arguments from *all* of the times that the function was called.
public private(set) var identifyEncodableReceivedInvocations: [(identifier: String, body: AnyEncodable)] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var identifyEncodableClosure: ((String, AnyEncodable) -> Void)?
/// Mocked function for `identify<RequestBody: Encodable>(identifier: String, body: RequestBody)`. Your opportunity to return a mocked value and check result of mock in test code.
public func identify<RequestBody: Encodable>(identifier: String, body: RequestBody) {
mockCalled = true
identifyCallsCount += 1
identifyEncodableReceivedArguments = (identifier: identifier, body: AnyEncodable(body))
identifyEncodableReceivedInvocations.append((identifier: identifier, body: AnyEncodable(body)))
identifyEncodableClosure?(identifier, AnyEncodable(body))
}
// MARK: - clearIdentify
/// Number of times the function was called.
public private(set) var clearIdentifyCallsCount = 0
/// `true` if the function was ever called.
public var clearIdentifyCalled: Bool {
clearIdentifyCallsCount > 0
}
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var clearIdentifyClosure: (() -> Void)?
/// Mocked function for `clearIdentify()`. Your opportunity to return a mocked value and check result of mock in test code.
public func clearIdentify() {
mockCalled = true
clearIdentifyCallsCount += 1
clearIdentifyClosure?()
}
// MARK: - track
/// Number of times the function was called.
public private(set) var trackCallsCount = 0
/// `true` if the function was ever called.
public var trackCalled: Bool {
trackCallsCount > 0
}
/// The arguments from the *last* time the function was called.
public private(set) var trackReceivedArguments: (name: String, data: [String: Any])?
/// Arguments from *all* of the times that the function was called.
public private(set) var trackReceivedInvocations: [(name: String, data: [String: Any])] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var trackClosure: ((String, [String: Any]) -> Void)?
/// Mocked function for `track(name: String, data: [String: Any])`. Your opportunity to return a mocked value and check result of mock in test code.
public func track(name: String, data: [String: Any]) {
mockCalled = true
trackCallsCount += 1
trackReceivedArguments = (name: name, data: data)
trackReceivedInvocations.append((name: name, data: data))
trackClosure?(name, data)
}
// MARK: - track<RequestBody: Encodable>
/// The arguments from the *last* time the function was called.
public private(set) var trackEncodableReceivedArguments: (name: String, data: AnyEncodable)?
/// Arguments from *all* of the times that the function was called.
public private(set) var trackEncodableReceivedInvocations: [(name: String, data: AnyEncodable)] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var trackEncodableClosure: ((String, AnyEncodable) -> Void)?
/// Mocked function for `track<RequestBody: Encodable>(name: String, data: RequestBody?)`. Your opportunity to return a mocked value and check result of mock in test code.
public func track<RequestBody: Encodable>(name: String, data: RequestBody?) {
mockCalled = true
trackCallsCount += 1
trackEncodableReceivedArguments = (name: name, data: AnyEncodable(data))
trackEncodableReceivedInvocations.append((name: name, data: AnyEncodable(data)))
trackEncodableClosure?(name, AnyEncodable(data))
}
// MARK: - screen
/// Number of times the function was called.
public private(set) var screenCallsCount = 0
/// `true` if the function was ever called.
public var screenCalled: Bool {
screenCallsCount > 0
}
/// The arguments from the *last* time the function was called.
public private(set) var screenReceivedArguments: (name: String, data: [String: Any])?
/// Arguments from *all* of the times that the function was called.
public private(set) var screenReceivedInvocations: [(name: String, data: [String: Any])] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var screenClosure: ((String, [String: Any]) -> Void)?
/// Mocked function for `screen(name: String, data: [String: Any])`. Your opportunity to return a mocked value and check result of mock in test code.
public func screen(name: String, data: [String: Any]) {
mockCalled = true
screenCallsCount += 1
screenReceivedArguments = (name: name, data: data)
screenReceivedInvocations.append((name: name, data: data))
screenClosure?(name, data)
}
// MARK: - screen<RequestBody: Encodable>
/// The arguments from the *last* time the function was called.
public private(set) var screenEncodableReceivedArguments: (name: String, data: AnyEncodable)?
/// Arguments from *all* of the times that the function was called.
public private(set) var screenEncodableReceivedInvocations: [(name: String, data: AnyEncodable)] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var screenEncodableClosure: ((String, AnyEncodable) -> Void)?
/// Mocked function for `screen<RequestBody: Encodable>(name: String, data: RequestBody?)`. Your opportunity to return a mocked value and check result of mock in test code.
public func screen<RequestBody: Encodable>(name: String, data: RequestBody?) {
mockCalled = true
screenCallsCount += 1
screenEncodableReceivedArguments = (name: name, data: AnyEncodable(data))
screenEncodableReceivedInvocations.append((name: name, data: AnyEncodable(data)))
screenEncodableClosure?(name, AnyEncodable(data))
}
// MARK: - registerDeviceToken
/// Number of times the function was called.
public private(set) var registerDeviceTokenCallsCount = 0
/// `true` if the function was ever called.
public var registerDeviceTokenCalled: Bool {
registerDeviceTokenCallsCount > 0
}
/// The arguments from the *last* time the function was called.
public private(set) var registerDeviceTokenReceivedArguments: String?
/// Arguments from *all* of the times that the function was called.
public private(set) var registerDeviceTokenReceivedInvocations: [String] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var registerDeviceTokenClosure: ((String) -> Void)?
/// Mocked function for `registerDeviceToken(_ deviceToken: String)`. Your opportunity to return a mocked value and check result of mock in test code.
public func registerDeviceToken(_ deviceToken: String) {
mockCalled = true
registerDeviceTokenCallsCount += 1
registerDeviceTokenReceivedArguments = deviceToken
registerDeviceTokenReceivedInvocations.append(deviceToken)
registerDeviceTokenClosure?(deviceToken)
}
// MARK: - deleteDeviceToken
/// Number of times the function was called.
public private(set) var deleteDeviceTokenCallsCount = 0
/// `true` if the function was ever called.
public var deleteDeviceTokenCalled: Bool {
deleteDeviceTokenCallsCount > 0
}
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var deleteDeviceTokenClosure: (() -> Void)?
/// Mocked function for `deleteDeviceToken()`. Your opportunity to return a mocked value and check result of mock in test code.
public func deleteDeviceToken() {
mockCalled = true
deleteDeviceTokenCallsCount += 1
deleteDeviceTokenClosure?()
}
// MARK: - trackMetric
/// Number of times the function was called.
public private(set) var trackMetricCallsCount = 0
/// `true` if the function was ever called.
public var trackMetricCalled: Bool {
trackMetricCallsCount > 0
}
/// The arguments from the *last* time the function was called.
public private(set) var trackMetricReceivedArguments: (deliveryID: String, event: Metric, deviceToken: String)?
/// Arguments from *all* of the times that the function was called.
public private(set) var trackMetricReceivedInvocations: [(deliveryID: String, event: Metric, deviceToken: String)] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
public var trackMetricClosure: ((String, Metric, String) -> Void)?
/// Mocked function for `trackMetric(deliveryID: String, event: Metric, deviceToken: String)`. Your opportunity to return a mocked value and check result of mock in test code.
public func trackMetric(deliveryID: String, event: Metric, deviceToken: String) {
mockCalled = true
trackMetricCallsCount += 1
trackMetricReceivedArguments = (deliveryID: deliveryID, event: event, deviceToken: deviceToken)
trackMetricReceivedInvocations.append((deliveryID: deliveryID, event: event, deviceToken: deviceToken))
trackMetricClosure?(deliveryID, event, deviceToken)
}
}
/**
Class to easily create a mocked version of the `DeviceAttributesProvider` class.
This class is equipped with functions and properties ready for you to mock!
Note: This file is automatically generated. This means the mocks should always be up-to-date and has a consistent API.
See the SDK documentation to learn the basics behind using the mock classes in the SDK.
*/
class DeviceAttributesProviderMock: DeviceAttributesProvider, Mock {
/// If *any* interactions done on mock. `true` if any method or property getter/setter called.
var mockCalled: Bool = false //
init() {
Mocks.shared.add(mock: self)
}
public func resetMock() {
getDefaultDeviceAttributesCallsCount = 0
getDefaultDeviceAttributesReceivedArguments = nil
getDefaultDeviceAttributesReceivedInvocations = []
mockCalled = false // do last as resetting properties above can make this true
}
// MARK: - getDefaultDeviceAttributes
/// Number of times the function was called.
private(set) var getDefaultDeviceAttributesCallsCount = 0
/// `true` if the function was ever called.
var getDefaultDeviceAttributesCalled: Bool {
getDefaultDeviceAttributesCallsCount > 0
}
/// The arguments from the *last* time the function was called.
private(set) var getDefaultDeviceAttributesReceivedArguments: (([String: Any]) -> Void)?
/// Arguments from *all* of the times that the function was called.
private(set) var getDefaultDeviceAttributesReceivedInvocations: [([String: Any]) -> Void] = []
/**
Set closure to get called when function gets called. Great way to test logic or return a value for the function.
*/
var getDefaultDeviceAttributesClosure: ((@escaping ([String: Any]) -> Void) -> Void)?
/// Mocked function for `getDefaultDeviceAttributes(onComplete: @escaping ([String: Any]) -> Void)`. Your opportunity to return a mocked value and check result of mock in test code.
func getDefaultDeviceAttributes(onComplete: @escaping ([String: Any]) -> Void) {
mockCalled = true
getDefaultDeviceAttributesCallsCount += 1
getDefaultDeviceAttributesReceivedArguments = onComplete
getDefaultDeviceAttributesReceivedInvocations.append(onComplete)
getDefaultDeviceAttributesClosure?(onComplete)
}
}
/**
Class to easily create a mocked version of the `SdkInitializedUtil` class.
This class is equipped with functions and properties ready for you to mock!
Note: This file is automatically generated. This means the mocks should always be up-to-date and has a consistent API.
See the SDK documentation to learn the basics behind using the mock classes in the SDK.
*/
public class SdkInitializedUtilMock: SdkInitializedUtil, Mock {
/// If *any* interactions done on mock. `true` if any method or property getter/setter called.
public var mockCalled: Bool = false //
public init() {
Mocks.shared.add(mock: self)
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingCustomerio: CustomerIO? = nil
/// `true` if the getter or setter of property is called at least once.
public var customerioCalled: Bool {
customerioGetCalled || customerioSetCalled
}
/// `true` if the getter called on the property at least once.
public var customerioGetCalled: Bool {
customerioGetCallsCount > 0
}
public var customerioGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var customerioSetCalled: Bool {
customerioSetCallsCount > 0
}
public var customerioSetCallsCount = 0
/// The mocked property with a getter and setter.
public var customerio: CustomerIO? {
get {
mockCalled = true
customerioGetCallsCount += 1
return underlyingCustomerio
}
set(value) {
mockCalled = true
customerioSetCallsCount += 1
underlyingCustomerio = value
}
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingIsInitlaized: Bool!
/// `true` if the getter or setter of property is called at least once.
public var isInitlaizedCalled: Bool {
isInitlaizedGetCalled || isInitlaizedSetCalled
}
/// `true` if the getter called on the property at least once.
public var isInitlaizedGetCalled: Bool {
isInitlaizedGetCallsCount > 0
}
public var isInitlaizedGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var isInitlaizedSetCalled: Bool {
isInitlaizedSetCallsCount > 0
}
public var isInitlaizedSetCallsCount = 0
/// The mocked property with a getter and setter.
public var isInitlaized: Bool {
get {
mockCalled = true
isInitlaizedGetCallsCount += 1
return underlyingIsInitlaized
}
set(value) {
mockCalled = true
isInitlaizedSetCallsCount += 1
underlyingIsInitlaized = value
}
}
/**
When setter of the property called, the value given to setter is set here.
When the getter of the property called, the value set here will be returned. Your chance to mock the property.
*/
public var underlyingPostInitializedData: (siteId: String, diGraph: DIGraph)? = nil
/// `true` if the getter or setter of property is called at least once.
public var postInitializedDataCalled: Bool {
postInitializedDataGetCalled || postInitializedDataSetCalled
}
/// `true` if the getter called on the property at least once.
public var postInitializedDataGetCalled: Bool {
postInitializedDataGetCallsCount > 0
}
public var postInitializedDataGetCallsCount = 0
/// `true` if the setter called on the property at least once.
public var postInitializedDataSetCalled: Bool {
postInitializedDataSetCallsCount > 0
}
public var postInitializedDataSetCallsCount = 0
/// The mocked property with a getter and setter.
public var postInitializedData: (siteId: String, diGraph: DIGraph)? {
get {
mockCalled = true
postInitializedDataGetCallsCount += 1
return underlyingPostInitializedData
}
set(value) {
mockCalled = true
postInitializedDataSetCallsCount += 1
underlyingPostInitializedData = value
}
}
public func resetMock() {
customerio = nil
customerioGetCallsCount = 0
customerioSetCallsCount = 0
isInitlaizedGetCallsCount = 0
isInitlaizedSetCallsCount = 0
postInitializedData = nil
postInitializedDataGetCallsCount = 0
postInitializedDataSetCallsCount = 0
}
}
// swiftlint:enable all