Last active
July 30, 2016 18:21
-
-
Save hoang-tran/901149f12321a47569519defae21be1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
@testable import MyAwesomeProject | |
class MyNativeTests: XCTestCase { | |
func testGunCanShootIfItHasBullets() { | |
// 1. Setup: create a gun with 1 bullet | |
let gun = Gun(bullets: 1) | |
// 2. Execution: shoot | |
gun.shoot() | |
// 3. Expectation: expect Gun to be out of bullet | |
XCTAssertTrue(gun.bullets == 0, "expect Gun to be out of bullet") | |
} | |
func testGunCannotShootIfItHasNoBullet() { | |
// 1. Setup: create a gun with no bullet | |
let gun = Gun(bullets: 0) | |
// 2. Execution: shoot | |
gun.shoot() | |
// 3. Expectation: expect Gun to not shoot anything | |
XCTAssertTrue(gun.bullets == 0, "expect the number of bullets to remain the same") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment