Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 2
    Aren't there mocking-frameworks in C#? This should solve your problems. Commented Feb 20, 2012 at 7:09
  • 2
    @user43552: That would just be testing a mock... this scenario is intended to test the audio player. Commented Feb 20, 2012 at 7:35
  • 5
    I'm not familiar with how to do audio in C#, but it seems to me that you need to refactor this class so that you can inject a mock in place of audioFile.SoundPlayer. Then test with this mock, and verify that PlaySync and Dispose are called at the right places. You also want to be able to inject the StartedPlayingHandler and the StoppedPlayingHandler if possible. Commented Feb 20, 2012 at 7:49
  • 2
    Shouldn't this be on stackoverflow? Commented Feb 20, 2012 at 11:15
  • 3
    @AmrH.AbdelMajeed - why? Just because it has code? Commented Feb 20, 2012 at 13:56