comparison SimoleonTests/SimoleonTests.swift @ 183:d2398f02e1ce

implement unit currency selector
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Mon, 20 Dec 2021 12:28:16 +0100
parents ba3ebe8cefe5
children 2fc95efcb1ee
comparison
equal deleted inserted replaced
182:ba3ebe8cefe5 183:d2398f02e1ce
15 } 15 }
16 16
17 override func tearDownWithError() throws { 17 override func tearDownWithError() throws {
18 // Put teardown code here. This method is called after the invocation of each test method in the class. 18 // Put teardown code here. This method is called after the invocation of each test method in the class.
19 } 19 }
20 20
21 func testExample() throws { 21 func testGetBaseCurrencies() throws {
22 // This is an example of a functional test case. 22 let baseCurrency = SupportedCurrencyResult(code: "EUR", name: "Euro", isCrypto: 0)
23 // Use XCTAssert and related functions to verify your tests produce the correct results. 23 let quoteCurrency = SupportedCurrencyResult(code: "CHF", name: "Swiss Franc", isCrypto: 0)
24 let currencyList = CurrencyList(
25 baseCurrency: .constant(baseCurrency),
26 quoteCurrency: .constant(quoteCurrency),
27 selecting: .baseCurrency
28 )
29
30 let baseCurrencies = currencyList.getCurrencies()
31 XCTAssertEqual(baseCurrencies.count, 5, "Base currencies does not match")
32 }
33
34 func testGetQuoteCurrencies() throws {
35 let baseCurrency = SupportedCurrencyResult(code: "EUR", name: "Euro", isCrypto: 0)
36 let quoteCurrency = SupportedCurrencyResult(code: "CHF", name: "Swiss Franc", isCrypto: 0)
37 let currencyList = CurrencyList(
38 baseCurrency: .constant(baseCurrency),
39 quoteCurrency: .constant(quoteCurrency),
40 selecting: .quoteCurrency
41 )
42
43 let quoteCurrencies = currencyList.getCurrencies()
44 XCTAssertEqual(quoteCurrencies.count, 18, "Quote currencies does not match")
24 } 45 }
25 46
26 func testPerformanceExample() throws { 47 func testPerformanceExample() throws {
27 // This is an example of a performance test case. 48 // This is an example of a performance test case.
28 self.measure { 49 self.measure {