예제 #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));
 }