Exemplo n.º 1
0
        public void GetAnswersTest()
        {
            var uians = new UIAnswer("First answer", true, 1);
            var ans   = new Answer("First answer", true)
            {
                Id = 1
            };
            var uiq = new UIQuestion("First question", 1);
            var q   = new Question("First question")
            {
                Id = 1, Answers = new List <Answer> {
                    ans
                }
            };


            var mockObj = TestsMethodsTests.Create(new List <Question> {
                q
            });
            var mockObjA = TestsMethodsTests.Create(new List <Answer> {
                ans
            });

            var mockContext = new Mock <Test2DBContainer>();

            mockContext.Setup(m => m.Questions).Returns(mockObj.Object);
            mockContext.Setup(m => m.Answers).Returns(mockObjA.Object);

            var service = new Service(mockContext.Object);

            var list = service.GetAnswers(uiq);

            Assert.IsTrue(list.Count == 1);
            Assert.AreEqual(1, list[0].Id);
        }
Exemplo n.º 2
0
        public void EditAnswer()
        {
            var uiq = new UIQuestion("First question", 1);
            var q   = new Question("First question")
            {
                Id = 1
            };
            var uians = new UIAnswer("First answer", true, 1);
            var ans   = new Answer("First answer", true)
            {
                Id = 1
            };

            var mockObj = TestsMethodsTests.Create(new List <Question> {
                q
            });
            var mockObjA = TestsMethodsTests.Create(new List <Answer> {
                ans
            });

            var mockContext = new Mock <Test2DBContainer>();

            mockContext.Setup(m => m.Questions).Returns(mockObj.Object);
            mockContext.Setup(m => m.Answers).Returns(mockObjA.Object);

            var service = new Service(mockContext.Object);

            service.SaveAnswer(uians, uiq);

            mockContext.Verify(m => m.SaveChanges(), Times.Once);
        }
Exemplo n.º 3
0
 private void WinOrLoss()
 {
     if (!closeUILoss)
     {
         GameLoss();
     }
     else
     {
         UIQuestion.SetActive(false);
         if (word == "Restart")
         {
             Restart();
             word = "";
         }
     }
 }
Exemplo n.º 4
0
    void Start()
    {
        type       = 0;
        resultUrl  = null;
        noOfQues   = 0;
        quizDomain = null;

        videoHolder     = GameObject.Find("VideoHolder").GetComponent <VideoPlayer>();
        ImageHolder     = GameObject.Find("imageHolder").GetComponent <Sprite_renderer>();
        QuestionsHolder = GameObject.Find("QuestSet").GetComponent <UIQuestion>();


        Augmentations = new Dictionary <int, GameObject>();

        for (int a = 0; a < AugmentationObjects.Length; ++a)
        {
            Augmentations.Add(AugmentationObjects[a].type,
                              AugmentationObjects[a].augmentation);
        }
    }
        public void DeleteQuestionTest()
        {
            var q = new Question("First question")
            {
                Id = 1
            };
            var uiq     = new UIQuestion("First question", 1);
            var mockObj = TestsMethodsTests.Create(new List <Question> {
                q
            });

            var mockContext = new Mock <Test2DBContainer>();

            mockContext.Setup(m => m.Questions).Returns(mockObj.Object);

            var service = new Service(mockContext.Object);

            service.DeleteQuestion(uiq);

            mockObj.Verify(x => x.Remove(It.IsAny <Question>()), Times.Once);
            mockContext.Verify(m => m.SaveChanges(), Times.Once);
        }
Exemplo n.º 6
0
    //Check Robot or Not
    private void GoOrNot()
    {
        if (word == "Absolutely")
        {
            if (!start)
            {
                StartCoroutine(Wait(2, 0));
                UIDoor.SetActive(false);
                UIQuestion.SetActive(true);
                UIStatus.SetActive(true);
                RandomQuestion();
                StartCoroutine(MoveCam());
                StartCoroutine(Wait(3, 4));
                timeStart = Time.time;
                start     = true;
            }
            word = "";
        }

        if (word == "Yes" || word == "Definitely")
        {
            if (!start)
            {
                count++;
                if (count < 3)
                {
                    StartCoroutine(Wait(12, 0));
                }
                else if (count == 3)
                {
                    Debug.Log("You are a Robot");
                    StartCoroutine(Wait(10, 0));
                    StartCoroutine(Quit());
                }
                word = "";
            }
        }
    }
Exemplo n.º 7
0
 private void GameLoss()
 {
     if (Time.time == 80 + Mathf.Round(timeStart))
     {
         if (!closeUILoss)
         {
             UIQuestion.SetActive(false);
             UIStatus.SetActive(false);
             UIEnd.SetActive(true);
             textWorL.text   = "LOSER";
             textResult.text = "YOUR POINT IS: " + point;
             StartCoroutine(Wait(6, 0));
             start = false;
         }
     }
     else if (Time.time >= 80 + Mathf.Round(timeStart))
     {
         if (word == "Restart")
         {
             Restart();
             word = "";
         }
     }
 }
Exemplo n.º 8
0
    private void Handle()
    {
        if (start)
        {
            for (int i = 0; i < 16; i++)
            {
                if (i < 8)
                {
                    if (word == keywordsY[index])
                    {
                        RandomQuestion();

                        if (!closeUILoss)
                        {
                            StartCoroutine(MoveCam());
                            StartCoroutine(Wait(13, 0));
                            StartCoroutine(Wait(5, 0.5f));
                            StartCoroutine(Wait(3, 3));
                            UIQuestion.SetActive(false);
                            StartCoroutine(SetActiveUIQuestion(2, UIQuestion, true));
                        }

                        point += 10;
                        word   = "";
                    }
                }
                if (word == keywordsN[i])
                {
                    StartCoroutine(Wait(14, 0));
                    StartCoroutine(Wait(4, 0.5f));
                    point -= 7;
                    word   = "";
                }
            }
        }
    }