Commit b9b4dde2 authored by Alex Klovak's avatar Alex Klovak
Browse files

covered NewsListControllerDelegate by tests

parent 0ba09f9f
......@@ -7,7 +7,7 @@
<key>AuthModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>24</integer>
<integer>27</integer>
</dict>
</dict>
</dict>
......
......@@ -7,137 +7,137 @@
<key>Alamofire.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
<integer>26</integer>
</dict>
<key>Firebase.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>FirebaseAnalytics.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>16</integer>
</dict>
<key>FirebaseAuth.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>23</integer>
</dict>
<key>FirebaseAuthInterop.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>17</integer>
<integer>5</integer>
</dict>
<key>FirebaseCore.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>21</integer>
<integer>14</integer>
</dict>
<key>FirebaseCoreDiagnostics.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>20</integer>
<integer>21</integer>
</dict>
<key>FirebaseCoreDiagnosticsInterop.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>14</integer>
<integer>20</integer>
</dict>
<key>FirebaseInstallations.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>27</integer>
<integer>4</integer>
</dict>
<key>FirebaseStorage.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>25</integer>
<integer>13</integer>
</dict>
<key>GTMSessionFetcher.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>9</integer>
</dict>
<key>GoogleAppMeasurement.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
<integer>17</integer>
</dict>
<key>GoogleDataTransport.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>15</integer>
<integer>18</integer>
</dict>
<key>GoogleDataTransportCCTSupport.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>10</integer>
<integer>12</integer>
</dict>
<key>GoogleMaps.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>22</integer>
<integer>8</integer>
</dict>
<key>GooglePlaces.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>18</integer>
<integer>24</integer>
</dict>
<key>GoogleUtilities.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>6</integer>
</dict>
<key>Kingfisher.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>12</integer>
<integer>10</integer>
</dict>
<key>Mapbox-iOS-SDK.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>16</integer>
<integer>25</integer>
</dict>
<key>MapboxDirections.swift.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>26</integer>
<integer>2</integer>
</dict>
<key>MapboxMobileEvents.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
<integer>11</integer>
</dict>
<key>Pods-AuthModule-AuthModuleUITests.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
<integer>19</integer>
</dict>
<key>Pods-AuthModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>19</integer>
<integer>15</integer>
</dict>
<key>Pods-AuthModuleTests.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>9</integer>
<integer>22</integer>
</dict>
<key>Polyline.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
<integer>3</integer>
</dict>
<key>PromisesObjC.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>23</integer>
<integer>0</integer>
</dict>
<key>nanopb.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>6</integer>
<integer>7</integer>
</dict>
</dict>
</dict>
......
......@@ -48,6 +48,7 @@
08AEC61F24BF2AC90013DA22 /* ContentLoaderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEC61E24BF2AC90013DA22 /* ContentLoaderTest.swift */; };
08AEC62124C034E40013DA22 /* NetworkManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEC62024C034E40013DA22 /* NetworkManagerTest.swift */; };
08AEC62424C0669D0013DA22 /* NewsRequestModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEC62324C0669D0013DA22 /* NewsRequestModelTest.swift */; };
08AEC62824C190C00013DA22 /* NewsListControllerDelegateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEC62724C190C00013DA22 /* NewsListControllerDelegateTest.swift */; };
08BE53D524A238B100C6489E /* LoadingCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08BE53D424A238B100C6489E /* LoadingCollectionCell.swift */; };
08BE53D724A238BD00C6489E /* LoadingCollectionCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 08BE53D624A238BD00C6489E /* LoadingCollectionCell.xib */; };
08BE53D924A23C1100C6489E /* NewsCellViewModelInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08BE53D824A23C1100C6489E /* NewsCellViewModelInterface.swift */; };
......@@ -135,6 +136,7 @@
08AEC61E24BF2AC90013DA22 /* ContentLoaderTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentLoaderTest.swift; sourceTree = "<group>"; };
08AEC62024C034E40013DA22 /* NetworkManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManagerTest.swift; sourceTree = "<group>"; };
08AEC62324C0669D0013DA22 /* NewsRequestModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsRequestModelTest.swift; sourceTree = "<group>"; };
08AEC62724C190C00013DA22 /* NewsListControllerDelegateTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsListControllerDelegateTest.swift; sourceTree = "<group>"; };
08BE53D424A238B100C6489E /* LoadingCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingCollectionCell.swift; sourceTree = "<group>"; };
08BE53D624A238BD00C6489E /* LoadingCollectionCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LoadingCollectionCell.xib; sourceTree = "<group>"; };
08BE53D824A23C1100C6489E /* NewsCellViewModelInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsCellViewModelInterface.swift; sourceTree = "<group>"; };
......@@ -294,11 +296,12 @@
path = Models;
sourceTree = "<group>";
};
08AEC62524C0776A0013DA22 /* Controllers */ = {
08AEC62624C190A70013DA22 /* Delegat */ = {
isa = PBXGroup;
children = (
08AEC62724C190C00013DA22 /* NewsListControllerDelegateTest.swift */,
);
path = Controllers;
path = Delegat;
sourceTree = "<group>";
};
08C98357249226B100D6B570 = {
......@@ -341,7 +344,7 @@
08C9837C249226B200D6B570 /* NewsListModuleTests */ = {
isa = PBXGroup;
children = (
08AEC62524C0776A0013DA22 /* Controllers */,
08AEC62624C190A70013DA22 /* Delegat */,
08AEC62224C066780013DA22 /* Models */,
08AEC61D24BF2A9F0013DA22 /* NetworkTests */,
08C9837D249226B200D6B570 /* NewsListModuleTests.swift */,
......@@ -771,6 +774,7 @@
08AEC62424C0669D0013DA22 /* NewsRequestModelTest.swift in Sources */,
08AEC62124C034E40013DA22 /* NetworkManagerTest.swift in Sources */,
08AEC61F24BF2AC90013DA22 /* ContentLoaderTest.swift in Sources */,
08AEC62824C190C00013DA22 /* NewsListControllerDelegateTest.swift in Sources */,
08C9837E249226B200D6B570 /* NewsListModuleTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
//
// NewsListControllerDelegateTest.swift
// NewsListModuleTests
//
// Created by Sasha Klovak on 17.07.2020.
// Copyright © 2020 Triare. All rights reserved.
//
import XCTest
@testable import NewsListModule
class NewsListControllerDelegateTest: XCTestCase {
fileprivate var delegateSpy: DelegateSpy!
override func setUpWithError() throws {
delegateSpy = DelegateSpy()
}
override func tearDownWithError() throws {
delegateSpy = nil
}
func testDelegateDidStart() {
delegateSpy.tableController.delegate?.didStartLoading()
XCTAssertTrue(delegateSpy.didStart)
}
func testDelegateDidFinish() {
delegateSpy.tableController.delegate?.didFinishLoading()
XCTAssertTrue(delegateSpy.didFinish)
}
func testDelegateDidLoadFeatured() {
delegateSpy.tableController.delegate?.didLoadFeaturedNews()
XCTAssertTrue(delegateSpy.didLoadFeatured)
}
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.
}
}
}
fileprivate class DelegateSpy: NSObject, NewsListControllerDelegate, UITableViewDelegate, UITableViewDataSource {
var tableController: NewsListTableController!
var didStart: Bool!
var didFinish: Bool!
var didLoadFeatured: Bool!
override init() {
super.init()
tableController = NewsListTableController(parentView: UIView(), tableDelegate: self, tableDataSource: self, delegate: self)
}
func didStartLoading() {
didStart = true
}
func didFinishLoading() {
didFinish = true
}
func didLoadFeaturedNews() {
didLoadFeatured = true
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment