-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathAvailabilityTests.swift
48 lines (38 loc) · 1.45 KB
/
AvailabilityTests.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
//
// AvailabilityTests.swift
// BuildaUtils
//
// Created by Honza Dvorsky on 10/3/15.
// Copyright © 2015 Honza Dvorsky. All rights reserved.
//
import XCTest
@testable import BuildaUtils
class AvailabilityTests: XCTestCase {
enum TestError: Error {
case one(String)
case two(String)
}
// MARK: AvailabilityCheckState testing
func testEqualityOfUncheckedStates() {
XCTAssertEqual(AvailabilityCheckState.unchecked, AvailabilityCheckState.unchecked)
}
func testEqualityOfCheckingStates() {
XCTAssertEqual(AvailabilityCheckState.checking, AvailabilityCheckState.checking)
}
func testEqualityOfFailedStates() {
let error1 = TestError.one("foo") as NSError
let error2 = TestError.one("bar") as NSError
XCTAssertEqual(AvailabilityCheckState.failed(error1), AvailabilityCheckState.failed(error2))
}
func testInequalityOfFailedStates() {
let error1 = TestError.one("") as NSError
let error2 = TestError.two("") as NSError
XCTAssertNotEqual(AvailabilityCheckState.failed(error1), AvailabilityCheckState.failed(error2))
}
func testEqualityOfSucceededStates() {
XCTAssertEqual(AvailabilityCheckState.succeeded, AvailabilityCheckState.succeeded)
}
func testInequalityOfUncheckedAndSucceededStates() {
XCTAssertNotEqual(AvailabilityCheckState.unchecked, AvailabilityCheckState.succeeded)
}
}