Timeline for How can I unit test audio?
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 7, 2015 at 23:57 | history | tweeted | twitter.com/#!/StackProgrammer/status/564211292886814720 | ||
| Jan 8, 2015 at 14:45 | answer | added | lfalin | timeline score: 3 | |
| Feb 20, 2012 at 13:56 | comment | added | ChrisF | @AmrH.AbdelMajeed - why? Just because it has code? | |
| Feb 20, 2012 at 11:15 | comment | added | Amr H. Abd Elmajeed | Shouldn't this be on stackoverflow? | |
| Feb 20, 2012 at 8:39 | answer | added | user281377 | timeline score: 9 | |
| Feb 20, 2012 at 7:49 | comment | added | Dawood ibn Kareem |
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.
|
|
| Feb 20, 2012 at 7:35 | comment | added | Steven Evers | @user43552: That would just be testing a mock... this scenario is intended to test the audio player. | |
| Feb 20, 2012 at 7:35 | comment | added | Kevin Hsu | Per what Chris replied, it's hard to test at the hardware level. That said, if you want to be hard core about it, you can patch the Line Out into Microphone, read the input audio, and perform some kind of (fuzzy) comparison to the source audio. Or, you could write your own audio device driver. But these are probably not worth the trouble. | |
| Feb 20, 2012 at 7:10 | history | edited | user8 | CC BY-SA 3.0 |
Remove tag from title
|
| Feb 20, 2012 at 7:09 | comment | added | user43552 | Aren't there mocking-frameworks in C#? This should solve your problems. | |
| Feb 20, 2012 at 6:13 | answer | added | Chris Pitman | timeline score: 12 | |
| Feb 20, 2012 at 5:10 | history | asked | IAE | CC BY-SA 3.0 |