iOS单元测试和UI测试全面解析(31)

发表于:2017-03-31来源:51CTO作者:朱先忠点击数: 标签:单元测试iOS
letsegmentedControl=UISegmentedControl() // when XCTAssertEqual(mockUserDefaults.gameStyleChanged,0, gameStyleChangedshouldbe0beforesendActions ) segmentedControl.addTarget(controllerUnderTest, action
  let segmentedControl = UISegmentedControl() 
  •   
  •   // when 
  •   XCTAssertEqual(mockUserDefaults.gameStyleChanged, 0, "gameStyleChanged should be 0 before sendActions"
  •   segmentedControl.addTarget(controllerUnderTest,  
  •       action: #selector(ViewController.chooseGameStyle(_:)), for: .valueChanged) 
  •   segmentedControl.sendActions(for: .valueChanged) 
  •   
  • 原文转自:http://mobile.51cto.com/iphone-535758.htm