-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UserCollectionViewControllerFactory
- Loading branch information
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
SWDestinyTrades/Classes/UserCollection/Factory/UserCollectionViewControllerFactory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// UserCollectionViewControllerFactory.swift | ||
// SWDestinyTrades | ||
// | ||
// Created by Diogo Autilio on 22/03/24. | ||
// Copyright © 2024 Diogo Autilio. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
final class UserCollectionViewControllerFactory: ViewControllerFactory { | ||
|
||
private let database: DatabaseProtocol? | ||
|
||
init(database: DatabaseProtocol?) { | ||
self.database = database | ||
} | ||
|
||
func createViewController() -> UIViewController { | ||
let view = UserCollectionTableView() | ||
let viewController = UserCollectionViewController(with: view, database: database) | ||
return viewController | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...TradesTests/Screens/UserCollection/Factory/UserCollectionViewControllerFactoryTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// UserCollectionViewControllerFactoryTests.swift | ||
// SWDestinyTradesTests | ||
// | ||
// Created by Diogo Autilio on 22/03/24. | ||
// Copyright © 2024 Diogo Autilio. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
|
||
@testable import SWDestinyTrades | ||
|
||
final class UserCollectionViewControllerFactoryTests: XCTestCase { | ||
|
||
private var sut: UserCollectionViewControllerFactory! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
sut = UserCollectionViewControllerFactory(database: nil) | ||
} | ||
|
||
override func tearDown() { | ||
sut = nil | ||
super.tearDown() | ||
} | ||
|
||
func test_controller_creation() { | ||
XCTAssertNotNil(sut.createViewController()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters