title: How to fake Realm Results for tests
body: <p>I have written a test to validate if a function is called :</p>
  
  <pre><code>  func test_getTaskLists_doNotCreateOrUpdateTaskListToStorageWhenSynchedLocally() {
  
     ...    
      let (datasource, restAPI, fakeTaskListStorage) = ...
  
      datasource.getTaskLists() { (taskLists, error) -&gt; Void in
        ...
        XCTAssertEqual(1, fakeTaskListStorage.readAllInvocationCount)
        ...      
      }
  ...
    }
  </code></pre>
  
  <p>The function is mocked to bypass super implementation and the issue is that the function returns a Results which I can't figure out to build/mock in order to return a valid object so the compiler stops complaining...I know I could just call super.readAll() but here I actually want to convert my test data (fakeTaskLists) to a fake Result object so everyone is happy...not sure if thats possible</p>
  
  <pre><code>class FakeTaskListsStorageRealm : TaskListStorageRealm {
      var fakeTaskLists:[TaskList]?
      override func readAll() -&gt; RealmSwift.Results&lt;TaskList&gt; {
        readAllInvocationCount += 1
        //Here I want to return fakeTaskLists somehow...
      }
  }
  </code></pre>