2

We have components encapsulates asynchronous logic. Now my question is, how can I test this, since my assert's time to run properly but honest too early?

Give it something like a global on-all-Thread's-wait command?

How you do go about it?

I Use MS Test, for example:

target = new MainViewModel(MOCK.GetDataService()); // The Magic asynchronous logic
lock (this) { Monitor.Wait(this, 50); } // my stupid solution
Assert.AreEqual(10, target.Count); // Assert
Ryan Gates
  • 4,501
  • 6
  • 50
  • 90

0 Answers0