     }
 
     func testTracksAdapter() {
-        let json = getJson(from: "contents")
-
-        guard let tracksArray = try? json["tracks"].rawData() else {
-            XCTFail("Sessions.json fixture doesn't have a \"tracks\" array")
-            fatalError()
-        }
-
-        guard let tracks = try? JSONDecoder().decode([Track].self, from: tracksArray) else {
-            XCTFail("Sessions.json fixture doesn't have a \"tracks\" array")
-            fatalError()
-        }
+        struct TestFixture: Decodable {
+            let tracks: [Track]
+        }
+
+        let tracks = loadFixture(from: "contents", type: TestFixture.self).tracks
 
         XCTAssertEqual(tracks.count, 8)
 

//

import XCTest
import SwiftyJSON
@testable import ConfCore

class AdapterTests: XCTestCase {

    private let dateTimeFormatter: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateFormat = confCoreDateFormat
        formatter.locale = Locale(identifier: "en-US")
        formatter.timeZone = TimeZone.current
        return formatter
    }()

    private func getJson(from filename: String) -> JSON {
        guard let fileURL = Bundle(for: AdapterTests.self).url(forResource: filename, withExtension: "json") else {
            XCTFail("Unable to find URL for fixture named \(filename)")
            fatalError()
        }

        guard let data = try? Data(contentsOf: fileURL), let json = try? JSON(data: data) else {
            XCTFail("Unable to load fixture named \(filename)")
            fatalError()
        }

        return json
    }

    private func getJSONData(from filename: String) -> Data {
        guard let fileURL = Bundle(for: AdapterTests.self).url(forResource: filename, withExtension: "json") else {
            XCTFail("Unable to find URL for fixture named \(filename)")
            fatalError()
        }

        guard let data = try? Data(contentsOf: fileURL) else {
            XCTFail("Unable to load fixture named \(filename)")
            fatalError()
        }

        return data
    }

    func testEventsAdapter() {
        let json = getJson(from: "contents")

        guard let eventsArray = try? json["events"].rawData() else {
            XCTFail("Sessions.json fixture doesn't have an \"events\" array")
            fatalError()
        }

        let decoder = JSONDecoder()
        decoder.dateDecodingStrategy = .formatted(.confCoreFormatter)

        guard let events = try? decoder.decode([Event].self, from: eventsArray) else {
            XCTFail("Sessions.json fixture doesn't have an \"events\" array")
            return
        }

        XCTAssertEqual(events.count, 5)


    }

    func testSessionsAdapter() {
        struct TestFixture: Decodable {
            let contents: [Session]
        }

        let sessions = loadFixture(from: "contents", type: TestFixture.self).contents

        XCTAssertEqual(sessions.count, 771)
        XCTAssertEqual(sessions[0].title, "Express Yourself!")
