view SimoleonTests/SimoleonTests.swift @ 187:13d5a8deb6c2

add AboutView and FavoritesView
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Thu, 23 Dec 2021 16:12:22 +0100
parents 1ebd1c5dd302
children
line wrap: on
line source

//
//  SimoleonTests.swift
//  SimoleonTests
//
//  Created by Dennis Concepción Martín on 8/12/21.
//

import XCTest
@testable import Simoleon

class SimoleonTests: XCTestCase {

    override func setUpWithError() throws {
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    override func tearDownWithError() throws {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
    }
    
    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 {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.
        }
    }

}