Mercurial > public > simoleon
diff SimoleonTests/SimoleonTests.swift @ 154:8afba86ab8dd
Refactor code
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Wed, 25 Aug 2021 10:43:12 +0100 |
parents | 2590ee472aa9 |
children | 8c3bbd640103 |
line wrap: on
line diff
--- a/SimoleonTests/SimoleonTests.swift Mon Aug 23 17:14:47 2021 +0100 +++ b/SimoleonTests/SimoleonTests.swift Wed Aug 25 10:43:12 2021 +0100 @@ -9,6 +9,7 @@ @testable import Simoleon class SimoleonTests: XCTestCase { + let fileController = FileController() override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. @@ -20,18 +21,18 @@ } func testReadJson() throws { - let currencyPairsSupported: [String]? = try? read(json: "CurrencyPairsSupported.json") + let currencyPairsSupported: [String]? = try? fileController.read(json: "CurrencyPairsSupported.json") XCTAssertNotNil(currencyPairsSupported, "An error occurred while reading CurrencyPairsSupported.json") - let currencyDetails: [String: CurrencyDetailsModel]? = try? read(json: "CurrencyDetails.json") + let currencyDetails: [String: CurrencyDetailsModel]? = try? fileController.read(json: "CurrencyDetails.json") XCTAssertNotNil(currencyDetails, "An error occurred while reading CurrencyDetails.json") } func testCurrencyExistence() throws { - let currencyDetails: [String: CurrencyDetailsModel] = try! read(json: "CurrencyDetails.json") + let currencyDetails: [String: CurrencyDetailsModel] = try! fileController.read(json: "CurrencyDetails.json") // Remove duplicates from currency pairs supported - let currencyPairsSupported: [String] = try! read(json: "CurrencyPairsSupported.json") + let currencyPairsSupported: [String] = try! fileController.read(json: "CurrencyPairsSupported.json") var currenciesSupported = Set<String>() for currencyPairSupported in currencyPairsSupported {