Esempio n. 1
0
        public void ToJSONTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            Question question = new Question(@"C:\Users\boris\Desktop\Workspace\Neurotest\NeurotestService\NeurotestClient\NeurotestClient\DataBase\Pictures\Fear\Fear30.jpg");

            JSONWrappers.Question result = question.ToJSON();

            Assert.AreEqual(result.Url, "Pictures/Fear/Fear30.jpg");
            Assert.AreEqual(result.Type, "Fear");
            Assert.AreEqual(result.Severity, "Strong");
        }
Esempio n. 2
0
        public void FromJSONTest()
        {
            Directory.SetCurrentDirectory(c_WorkingDir);

            JSONWrappers.Question jsonQuestion = new JSONWrappers.Question
            {
                Url      = "Pictures/Astonishment/Astonishment10.jpg",
                Type     = EmotionType.Astonishment.ToString("G"),
                Severity = EmotionSeverity.Weak.ToString("G")
            };
            Question result = Question.FromJSON(jsonQuestion);

            Assert.AreEqual(result.Path, @"C:\Users\boris\Desktop\Workspace\Neurotest\NeurotestService\NeurotestClient\NeurotestClient\DataBase\Pictures\Astonishment\Astonishment10.jpg");
            Assert.AreEqual(result.Type, EmotionType.Astonishment);
            Assert.AreEqual(result.Severity, EmotionSeverity.Weak);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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());
        }
Esempio n. 5
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());
        }
Esempio n. 6
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());
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }