コード例 #1
0
        public void GetSeverityTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Happiness/Happiness10.jpg",
                Type     = EmotionType.Happiness.ToString("G"),
                Severity = EmotionSeverity.Weak.ToString("G")
            };
            JSONWrappers.Answer jsonAnswer = new JSONWrappers.Answer
            {
                Question    = jsonQuestion,
                UserInput   = EmotionType.Astonishment.ToString("G"),
                ElapsedTime = "5.5"
            };
            Answer answer = Answer.FromJSON(jsonAnswer);

            Assert.AreEqual(answer.GetSeverity(), EmotionSeverity.Weak);
        }
コード例 #2
0
        public void IsSimilarFifthTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Astonishment/Astonishment20.jpg",
                Type     = EmotionType.Astonishment.ToString("G"),
                Severity = EmotionSeverity.Average.ToString("G")
            };
            JSONWrappers.Answer jsonAnswer = new JSONWrappers.Answer
            {
                Question    = jsonQuestion,
                UserInput   = EmotionType.Sadness.ToString("G"),
                ElapsedTime = "5.5"
            };
            Answer answer = Answer.FromJSON(jsonAnswer);

            Assert.IsFalse(answer.IsSimilar());
        }
コード例 #3
0
        public void IsSimilarFirstTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Disgust/Disgust20.jpg",
                Type     = EmotionType.Disgust.ToString("G"),
                Severity = EmotionSeverity.Average.ToString("G")
            };
            JSONWrappers.Answer jsonAnswer = new JSONWrappers.Answer
            {
                Question    = jsonQuestion,
                UserInput   = EmotionType.Anger.ToString("G"),
                ElapsedTime = "5.5"
            };
            Answer answer = Answer.FromJSON(jsonAnswer);

            Assert.IsTrue(answer.IsSimilar());
        }
コード例 #4
0
        public void IsRightSecondTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Fear/Fear20.jpg",
                Type     = EmotionType.Fear.ToString("G"),
                Severity = EmotionSeverity.Average.ToString("G")
            };
            JSONWrappers.Answer jsonAnswer = new JSONWrappers.Answer
            {
                Question    = jsonQuestion,
                UserInput   = EmotionType.Fear.ToString("G"),
                ElapsedTime = "5.5"
            };
            Answer answer = Answer.FromJSON(jsonAnswer);

            Assert.IsTrue(answer.IsRight());
        }
コード例 #5
0
        public void FromJSONTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Happiness/Happiness10.jpg",
                Type     = EmotionType.Happiness.ToString("G"),
                Severity = EmotionSeverity.Weak.ToString("G")
            };
            JSONWrappers.Answer jsonAnswer = new JSONWrappers.Answer
            {
                Question    = jsonQuestion,
                UserInput   = EmotionType.Happiness.ToString("G"),
                ElapsedTime = "5.5"
            };
            Answer result = Answer.FromJSON(jsonAnswer);

            /* Don't testing Question convertion, because it belongs to another test */
            Assert.AreEqual(result.UserInput, EmotionType.Happiness);
            Assert.AreEqual(result.ElapsedTime, 5.5f);
        }
コード例 #6
0
        public void ToCSVStringTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Happiness/Happiness10.jpg",
                Type     = EmotionType.Happiness.ToString("G"),
                Severity = EmotionSeverity.Weak.ToString("G")
            };
            JSONWrappers.Answer jsonAnswer = new JSONWrappers.Answer
            {
                Question    = jsonQuestion,
                UserInput   = EmotionType.Happiness.ToString("G"),
                ElapsedTime = "5.5"
            };
            Answer answer   = Answer.FromJSON(jsonAnswer);
            string result   = answer.ToCSVString();
            string expected = @"C:\Users\boris\Desktop\Workspace\Neurotest\NeurotestService\NeurotestClient\NeurotestClient\DataBase\Pictures\Happiness\Happiness10.jpg;" +
                              "Happiness;Happiness;5,50\n";

            Assert.AreEqual(result, expected);
        }