public void Play_FileDoesNotExist_Throws() { var x = AudioFactory.AudioSession(Path.GetRandomFileName()); Assert.Throws <FileNotFoundException>(() => x.Play()); }
public void Construct_FileDoesNotExist_DoesNotCreateFile() { var path = Path.GetRandomFileName(); var x = AudioFactory.AudioSession(path); Assert.IsFalse(File.Exists(path)); }
public RecordingSession() { _tempFile = new TempFile(); _recorder = AudioFactory.AudioSession(_tempFile.Path); _recorder.StartRecording(); Thread.Sleep(100); }
public void StopRecording_NotRecording_Throws() { var x = AudioFactory.AudioSession(Path.GetRandomFileName()); Assert.Throws <ApplicationException>(() => x.StopRecordingAndSaveAsWav()); }
public void Construct_FileDoesExistButEmpty_OK() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); } }
public void CanRecord_ConstructWithEmptyFile_True() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); Assert.IsTrue(x.CanRecord); } }
public void Play_DoesPlay() { using (var file = TempFile.FromResource(Resources.finished, ".wav")) { var x = AudioFactory.AudioSession(file.Path); Assert.DoesNotThrow(() => x.Play()); Assert.DoesNotThrow(() => x.StopPlaying()); } }
public void Play_FileEmpty_Throws() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); Assert.Throws <Exception>(() => x.Play()); } }
private ISimpleAudioSession RecordSomething(TempFile f) { var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); Thread.Sleep(100); x.StopRecordingAndSaveAsWav(); return(x); }
public void Record_DoesRecord() { string fpath = "/tmp/dump.ogg"; var x = AudioFactory.AudioSession(fpath); Assert.DoesNotThrow(() => x.StartRecording()); Assert.IsTrue(x.IsRecording); Thread.Sleep(1000); Assert.DoesNotThrow(() => x.StopRecordingAndSaveAsWav()); }
public void IsRecording_WhileRecording_True() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); Thread.Sleep(100); Assert.IsTrue(x.IsRecording); x.StopRecordingAndSaveAsWav(); } }
public void RecordThenPlay_SmokeTest() { using (var f = new TempFile()) { var w = new BackgroundWorker(); w.DoWork += new DoWorkEventHandler((o, args) => SystemSounds.Exclamation.Play()); var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); w.RunWorkerAsync(); Thread.Sleep(1000); x.StopRecordingAndSaveAsWav(); x.Play(); Thread.Sleep(1000); x.StopPlaying(); } }
public void RecordAndStop_FileAlreadyExists_FileReplaced() { using (var f = new TempFile()) { var old = File.GetLastWriteTimeUtc(f.Path); var oldInfo = new FileInfo(f.Path); var oldLength = oldInfo.Length; Assert.AreEqual(0, oldLength); var oldTimestamp = oldInfo.LastWriteTimeUtc; var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); Thread.Sleep(1000); x.StopRecordingAndSaveAsWav(); var newInfo = new FileInfo(f.Path); Assert.Greater(newInfo.LastWriteTimeUtc, oldTimestamp); Assert.Greater(newInfo.Length, oldLength); } }
public void Play_GiveThaiFileName_ShouldHearTwoSounds() { using (var d = new TemporaryFolder("palaso media test")) { var soundPath = d.Combine("ก.wav"); File.Create(soundPath).Close(); using (var f = TempFile.TrackExisting(soundPath)) { var w = new BackgroundWorker(); w.DoWork += new DoWorkEventHandler((o, args) => SystemSounds.Exclamation.Play()); var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); w.RunWorkerAsync(); Thread.Sleep(1000); x.StopRecordingAndSaveAsWav(); var y = AudioFactory.AudioSession(f.Path); y.Play(); Thread.Sleep(1000); y.StopPlaying(); } } }
public void CanStop_NonExistantFile_False() { var x = AudioFactory.AudioSession(Path.GetRandomFileName()); Assert.IsFalse(x.CanStop); }
public void CanRecord_FileDoesNotExist_True() { var x = AudioFactory.AudioSession(Path.GetRandomFileName()); Assert.IsTrue(x.CanRecord); }
public void Construct_FileDoesNotExist_OK() { var x = AudioFactory.AudioSession(Path.GetRandomFileName()); }