public void Update()
 {
     spelling.Update();
     building.Update();
     if (building.model.isSelectNow)
     {
         building.model.isSelectNow  = false;
         spelling.model.contentIndex = building.model.selectedIndex;
         spelling.Populate();
     }
     else if (spelling.model.isExitNow)
     {
         if (1 <= spelling.model.answerCount)
         {
             building.model.Answer(spelling.model.answerCount);
         }
         spelling.model.isExitNow = false;
         building.model.state     = "spellingToBuilding";
     }
     else if (spelling.model.isAnswerAllNow)
     {
         spelling.model.isAnswerAllNow = false;
         building.model.state          = "spellingToBuilding";
         building.model.Complete();
     }
     AnimationView.SetState(view.state, building.model.state);
 }
        private SpellingController AssertButtonSelectedToggles()
        {
            var controller = new SpellingController();

            controller.model.score = 2000;
            controller.Setup();
            controller.Populate();
            controller.Update();
            Assert.AreEqual("2000",
                            TextView.GetText(
                                controller.view.scoreText));
            Assert.AreEqual(false,
                            SceneNodeView.GetVisible(
                                controller.view.selected.answers[0]));
            var button0 = controller.view.letterButtons[0];

            controller.buttons.view.Down(button0);
            controller.Update();
            AssertLetterSelected(controller, 0, 0);
            Assert.AreEqual("1999",
                            TextView.GetText(
                                controller.view.scoreText),
                            "Each letter selected decrements score.");
            controller.buttons.view.Down(button0);
            controller.Update();
            Assert.AreEqual(false,
                            SceneNodeView.GetVisible(
                                controller.view.selected.answers[0]));
            Assert.AreEqual("1999",
                            TextView.GetText(
                                controller.view.scoreText));
            controller.buttons.view.Down(button0);
            controller.Update();
            AssertLetterSelected(controller, 0, 0);
            controller.buttons.view.Down(button0);
            controller.Update();
            Assert.AreEqual(false,
                            SceneNodeView.GetVisible(
                                controller.view.selected.answers[0]));
            return(controller);
        }