//
//  CameraServiceFactoryTests.swift
//  suixinkanTests
//

import XCTest
@testable import suixinkan

/// CameraServiceFactory 测试。
@MainActor
final class CameraServiceFactoryTests: XCTestCase {
    func testMakeSonyReturnsSonyService() {
        let service = CameraServiceFactory.make(brand: .sony)
        XCTAssertTrue(service is SonyCameraService)
        XCTAssertEqual(service.brand, .sony)
    }

    func testMakeCanonReturnsCanonService() {
        let service = CameraServiceFactory.make(brand: .canon)
        XCTAssertTrue(service is CanonCameraService)
        XCTAssertEqual(service.brand, .canon)
    }

    func testMakeAutoDetectReturnsAutoDetectService() {
        let service = CameraServiceFactory.makeAutoDetect()
        XCTAssertTrue(service is AutoDetectCameraService)
    }

    func testMakeAutoDetectReturnsSharedInstance() {
        let first = CameraServiceFactory.makeAutoDetect()
        let second = CameraServiceFactory.makeAutoDetect()
        XCTAssertTrue(first === second)
    }
}
