How to use testLastSetValueStub_returnsLastSetValue method of LastSetValueStubTests class

Best Mockingbird code snippet using LastSetValueStubTests.testLastSetValueStub_returnsLastSetValue

Run Mockingbird automation tests on LambdaTest cloud grid

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

LastSetValueStubTests.swift

Source: LastSetValueStubTests.swift Github

copy
1//
2//  LastSetValueStubTests.swift
3//  MockingbirdTests
4//
5//  Created by Andrew Chang on 8/17/19.
6//  Copyright © 2019 Bird Rides, Inc. All rights reserved.
7//
8
9import XCTest
10import Mockingbird
11@testable import MockingbirdTestsHost
12
13class LastSetValueStubTests: XCTestCase {
14  
15  var child: ChildProtocolMock!
16  var concreteChild: ChildProtocol!
17  
18  override func setUp() {
19    child = MockingbirdTests.mock(ChildProtocol.self)
20    concreteChild = child as ChildProtocol
21  }
22  
23  func testLastSetValueStub_returnsInitialValue() {
24    given(child.getChildInstanceVariable()) ~> lastSetValue(initial: false)
25    XCTAssertFalse(concreteChild.childInstanceVariable)
26  }
27  
28  func testLastSetValueStub_returnsInitialValue_explicitSyntax() {
29    given(child.getChildInstanceVariable()).willReturn(lastSetValue(initial: false))
30    XCTAssertFalse(concreteChild.childInstanceVariable)
31  }
32  
33  func testLastSetValueStub_returnsLastSetValue() {
34    given(child.getChildInstanceVariable()) ~> lastSetValue(initial: false)
35    concreteChild.childInstanceVariable = true
36    XCTAssertTrue(concreteChild.childInstanceVariable)
37  }
38  
39  func testLastSetValueStub_returnsLastSetValue_explicitSyntax() {
40    given(child.getChildInstanceVariable()).willReturn(lastSetValue(initial: false))
41    concreteChild.childInstanceVariable = true
42    XCTAssertTrue(concreteChild.childInstanceVariable)
43  }
44  
45  func testLastSetValueStub_settingValueOverridesLastSetValue() {
46    given(child.getChildInstanceVariable()) ~> lastSetValue(initial: false)
47    concreteChild.childInstanceVariable = true
48    concreteChild.childInstanceVariable = false
49    XCTAssertFalse(concreteChild.childInstanceVariable)
50  }
51  
52  func testLastSetValueStub_settingValueOverridesLastSetValue_explicitSyntax() {
53    given(child.getChildInstanceVariable()).willReturn(lastSetValue(initial: false))
54    concreteChild.childInstanceVariable = true
55    concreteChild.childInstanceVariable = false
56    XCTAssertFalse(concreteChild.childInstanceVariable)
57  }
58}
59
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 testLastSetValueStub_returnsLastSetValue code on LambdaTest Cloud Grid

Execute automation tests with testLastSetValueStub_returnsLastSetValue 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)