コード例 #1
0
        public void SetQuestionRecording_Success()
        {
            InterviewQuestion oQuestion = GetInterviewQuestionFromTemporaryHandler();

            //set stream
            var res = oQuestion.SetQuestionRecording("Dummy.wav", true);

            Assert.IsTrue(res.Success, "Setting recording to wav file failed:" + res);

            //fetch it again, make sure it downloads
            res = oQuestion.RefetchInterviewHandlerData();
            Assert.IsTrue(res.Success, "failed to refetch interview handler data");

            string strTemp = Path.GetTempFileName() + ".wav";

            res = oQuestion.GetQuestionRecording(strTemp);
            Assert.IsTrue(res.Success, "Fetching recording that was just uploaded failed:" + res);
            Assert.IsTrue(File.Exists(strTemp), "Wav file target does not exist after download:" + strTemp);

            try
            {
                File.Delete(strTemp);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failure deleting temporary file for question recording fetch:" + ex);
            }
        }