Pablo
10/01/2020, 7:32 AMMainScope()
and I use it like :
@Inject constructor(
...
...
private val mainScope : CoroutineScope,
private val ioDispatcher: CoroutineDispatcher,
...
...
)
And then using it like this
mainScope.launch{
...
result withContext(ioDispatcher) {...}
...
}
If I do Dispatchers.setMain(TestCoroutineDispatcher())
does it change also the ioDispatcher
?
On my test I'm doing it like this :
private val testDispatcher = TestCoroutineDispatcher()
private val mainScope = TestCoroutineScope(testDispatcher)
And then on the @Before
I'm using this Dispatchers.setMain(testDispatcher)
And on every test I'm using
mainScope.runBlockingTest{...}
or
testDispatcher.runBlockingTest{...}
Is something I could improve?gildor
10/01/2020, 7:44 AMdoes it change also theNo, there is no such mechanism for other dispatchersioDispatcher
private val testDispatcher = TestCoroutineDispatcher()
private val mainScope = TestCoroutineScope(testDispatcher)It’s redundant, you can just use TestCoroutineScope()
Pablo
10/02/2020, 12:39 PMprivate val testDispatcher = TestCoroutineDispatcher()
private val mainScope = TestCoroutineScope(testDispatcher)
...
presenter(...,mainScope,testDispatcher)
This is still redundant?gildor
10/03/2020, 8:16 AMPablo
10/03/2020, 8:18 AMgildor
10/03/2020, 1:29 PMPablo
10/07/2020, 9:36 AMgildor
10/07/2020, 9:43 AMPablo
10/07/2020, 9:48 AM