How to use testVariadicMethod_calledWithStrings_usingStrictMatching method of VeriadicParametersTests class

Best Mockingbird code snippet using VeriadicParametersTests.testVariadicMethod_calledWithStrings_usingStrictMatching

Run Mockingbird automation tests on LambdaTest cloud grid

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

VariadicParametersTests.swift

Source: VariadicParametersTests.swift Github

copy
1//
2//  VariadicParametersTests.swift
3//  MockingbirdTests
4//
5//  Created by Andrew Chang on 8/21/19.
6//  Copyright © 2019 Bird Rides, Inc. All rights reserved.
7//
8
9import XCTest
10import Mockingbird
11@testable import MockingbirdTestsHost
12
13class VeriadicParametersTests: XCTestCase {
14  
15  var concreteMock: VariadicProtocolMock!
16  
17  override func setUp() {
18    concreteMock = mock(VariadicProtocol.self)
19  }
20  
21  func callVariadicStringsMethod(on object: VariadicProtocol) {
22    object.variadicMethod(objects: "a", "b", "c", param2: 1)
23  }
24  func callVariadicBoolsMethod(on object: VariadicProtocol) {
25    object.variadicMethod(objects: true, false, true, param2: 1)
26  }
27  func callVariadicReturningMethod(on object: VariadicProtocol) -> Bool {
28    return object.variadicReturningMethod(objects: true, false, true, param2: 1)
29  }
30  
31  func testVariadicMethod_calledWithStrings_usingStrictMatching() {
32    callVariadicStringsMethod(on: concreteMock)
33    verify(concreteMock.variadicMethod(objects: "a", "b", "c", param2: 1)).wasCalled()
34  }
35  func testVariadicMethod_calledWithStrings_usingWildcardMatching() {
36    callVariadicStringsMethod(on: concreteMock)
37    verify(concreteMock.variadicMethod(objects: any([String].self), param2: 1)).wasCalled()
38  }
39  
40  func testVariadicMethod_calledWithBools_usingStrictMatching() {
41    callVariadicBoolsMethod(on: concreteMock)
42    verify(concreteMock.variadicMethod(objects: true, false, true, param2: 1)).wasCalled()
43  }
44  func testVariadicMethod_calledWithBools_usingWildcardMatching() {
45    callVariadicBoolsMethod(on: concreteMock)
46    verify(concreteMock.variadicMethod(objects: any([Bool].self), param2: 1)).wasCalled()
47  }
48  
49  func testVariadicReturningMethod_calledWithBools_usingStrictMatching() {
50    given(concreteMock.variadicReturningMethod(objects: true, false, true, param2: 1)) ~> true
51    XCTAssertTrue(callVariadicReturningMethod(on: concreteMock))
52    verify(concreteMock.variadicReturningMethod(objects: true, false, true, param2: 1)).wasCalled()
53  }
54  func testVariadicReturningMethod_calledWithBools_usingWildcardMatching() {
55    given(concreteMock.variadicReturningMethod(objects: any(), param2: 1)) ~> true
56    XCTAssertTrue(callVariadicReturningMethod(on: concreteMock))
57    verify(concreteMock.variadicReturningMethod(objects: any(), param2: 1)).wasCalled()
58  }
59}
60
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger testVariadicMethod_calledWithStrings_usingStrictMatching code on LambdaTest Cloud Grid

Execute automation tests with testVariadicMethod_calledWithStrings_usingStrictMatching on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)