IOS-1495 messagequeryresult shared between all the test IOS-1495
authorXavier Algarra <xavier@pep-project.org>
Fri, 15 Mar 2019 18:52:24 +0100
branchIOS-1495
changeset 8011da69019044e1
parent 8010 3621302b5624
child 8012 3b0fadafee82
IOS-1495 messagequeryresult shared between all the test
pEpForiOSTests/Models/EmailListViewModelTest.swift
     1.1 --- a/pEpForiOSTests/Models/EmailListViewModelTest.swift	Fri Mar 15 17:47:17 2019 +0100
     1.2 +++ b/pEpForiOSTests/Models/EmailListViewModelTest.swift	Fri Mar 15 18:52:24 2019 +0100
     1.3 @@ -17,6 +17,7 @@
     1.4      var emailListVM : EmailListViewModel!
     1.5      var server: TestServer!
     1.6      var masterViewController: TestMasterViewController!
     1.7 +    var messageQueryResults: MessageQueryResults!
     1.8  
     1.9      /** this set up a view model with one account and one folder saved **/
    1.10      override func setUp() {
    1.11 @@ -31,6 +32,8 @@
    1.12                               account: folder.account,
    1.13                               folderType: .trash)
    1.14          trashFolder.save()
    1.15 +        messageQueryResults = MessageQueryResults(withFolder: folder)
    1.16 +        test
    1.17      }
    1.18  
    1.19      // MARK: - Test section
    1.20 @@ -46,6 +49,7 @@
    1.21  
    1.22      func test10MessagesInInitialSetup() {
    1.23          let msg = TestUtil.createMessages(number: 10, engineProccesed: true, inFolder: folder, setUids: true)
    1.24 +        server.insertMessagesWithoutDelegate(messages: msg)
    1.25          setupViewModel()
    1.26          XCTAssertEqual(emailListVM.rowCount, 10)
    1.27      }
    1.28 @@ -464,16 +468,18 @@
    1.29          let msgsyncservice = MessageSyncService()
    1.30          self.emailListVM = EmailListViewModel(emailListViewModelDelegate: masterViewController,
    1.31                                                messageSyncService: msgsyncservice,
    1.32 -                                              folderToShow: folder, messageQueryResults: MessageQueryResults(withFolder: folder))
    1.33 +                                              folderToShow: folder, messageQueryResults: messageQueryResults)
    1.34  
    1.35      }
    1.36  
    1.37 -    fileprivate func setUpMessageFolderDelegate() {
    1.38 -        //self.server = TestServer(messageFolderDelegate: emailListVM)
    1.39 +    fileprivate func setServer() {
    1.40 +        self.server = TestServer(messageQueryResults: messageQueryResults)
    1.41 +
    1.42      }
    1.43  
    1.44      fileprivate func setupViewModel() {
    1.45          createViewModelWithExpectations(expectedUpdateView: true)
    1.46 +        setServer()
    1.47      }
    1.48  
    1.49      fileprivate func setSearchFilter(text: String) {