Пример #1
0
        public void GenerateAudioTestWithROI()
        {
            String testString = "fEwS21";
            var    stream     = AudioFactory.GenerateAudio(testString, -7);

            Assert.IsNotNull(stream);
        }
Пример #2
0
 /// <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);
     }
 }
Пример #3
0
 public void ThrowExceptionOnSpeechRateTest()
 {
     String testString = "fEwS21";
     var    stream     = AudioFactory.GenerateAudio(testString, -73);
 }
Пример #4
0
 public void GenerateAudioEmptyCaptchaCodeTest()
 {
     String testString = null;
     var    stream     = AudioFactory.GenerateAudio(testString, -7);
 }
Пример #5
0
 public void GenerateAudioIllegalCaptchaCodeTest()
 {
     String testString = "";
     var    stream     = AudioFactory.GenerateAudio(testString, -7);
 }
Пример #6
0
 public static MemoryStream GenerateAudio(string code)
 {
     return(AudioFactory.GenerateAudio(code));
 }