public void GenerateAudioTestWithROI() { String testString = "fEwS21"; var stream = AudioFactory.GenerateAudio(testString, -7); Assert.IsNotNull(stream); }
/// <summary> /// Returns a response message with audio as content /// </summary> /// <param name="id">Captcha string for which the audio is to be generated</param> /// <returns>HttpResponseMessage with "audio/wav" header</returns> public HttpResponseMessage Get(string id) { try { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); var audioStream = AudioFactory.GenerateAudio(id); audioStream.Position = 0; response.Content = new StreamContent(audioStream); response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("audio/wav"); return(response); } catch (Exception ex) { var res = new HttpResponseMessage(); res.StatusCode = HttpStatusCode.BadRequest; return(res); } }
public void ThrowExceptionOnSpeechRateTest() { String testString = "fEwS21"; var stream = AudioFactory.GenerateAudio(testString, -73); }
public void GenerateAudioEmptyCaptchaCodeTest() { String testString = null; var stream = AudioFactory.GenerateAudio(testString, -7); }
public void GenerateAudioIllegalCaptchaCodeTest() { String testString = ""; var stream = AudioFactory.GenerateAudio(testString, -7); }
public static MemoryStream GenerateAudio(string code) { return(AudioFactory.GenerateAudio(code)); }