コード例 #1
0
        public void GetVideoSampleTest()
        {
            List <JSONWrappers.VideoInfo> sample = VideosDataBase.GetVideoSample(EmotionType.Astonishment, EmotionType.Fear);

            Assert.AreEqual(sample[0].Type, "Astonishment");
            Assert.AreEqual(sample[1].Type, "Fear");
        }
コード例 #2
0
        public IEnumerable <JSONWrappers.VideoInfo> GetVideoSampleForSubject(ulong id)
        {
            try
            {
                m_Logger.LogInformation($"Request for video sample by subject with ID {id}");

                (EmotionType best, EmotionType worst) = TestDataBase.GetBestAndWorstRecognizedEmotionTypesForSubject(id);
                if ((best == EmotionType.Undefined) || (worst == EmotionType.Undefined))
                {
                    /* There is no subject with this ID */
                    m_Logger.LogDebug($"Attempt to access non-existent subject with ID {id}");
                    return(new List <JSONWrappers.VideoInfo>());
                }

                return(VideosDataBase.GetVideoSample(best, worst));
            }
            catch (Exception e)
            {
                m_Logger.LogError(e.Message);
                throw;
            }
        }