Mercurial > public > simoleon
diff 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 |
line wrap: on
line diff
--- a/SimoleonTests/SimoleonTests.swift Wed Dec 08 10:58:15 2021 +0100 +++ b/SimoleonTests/SimoleonTests.swift Mon Dec 20 12:28:16 2021 +0100 @@ -17,10 +17,31 @@ override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. + + func testGetBaseCurrencies() throws { + let baseCurrency = SupportedCurrencyResult(code: "EUR", name: "Euro", isCrypto: 0) + let quoteCurrency = SupportedCurrencyResult(code: "CHF", name: "Swiss Franc", isCrypto: 0) + let currencyList = CurrencyList( + baseCurrency: .constant(baseCurrency), + quoteCurrency: .constant(quoteCurrency), + selecting: .baseCurrency + ) + + let baseCurrencies = currencyList.getCurrencies() + XCTAssertEqual(baseCurrencies.count, 5, "Base currencies does not match") + } + + func testGetQuoteCurrencies() throws { + let baseCurrency = SupportedCurrencyResult(code: "EUR", name: "Euro", isCrypto: 0) + let quoteCurrency = SupportedCurrencyResult(code: "CHF", name: "Swiss Franc", isCrypto: 0) + let currencyList = CurrencyList( + baseCurrency: .constant(baseCurrency), + quoteCurrency: .constant(quoteCurrency), + selecting: .quoteCurrency + ) + + let quoteCurrencies = currencyList.getCurrencies() + XCTAssertEqual(quoteCurrencies.count, 18, "Quote currencies does not match") } func testPerformanceExample() throws {