public void Setup()
 {
     if (null == view)
     {
         view = (MainView)SceneNodeView.FindObjectOfType(typeof(MainView));
         view.Setup();
     }
     spelling.Setup();
     spelling.Populate();
     building.model.cellCount = DataUtil.Length(spelling.model.table) - 1;
     building.Setup();
 }
        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);
        }
        public void PopulateMatchesFirstLetter()
        {
            var controller = new SpellingController();

            controller.Setup();
            controller.Populate();
            Assert.AreEqual(controller.model.letterButtonTexts[0],
                            TextView.GetText(controller.view.letterButtonTexts[0]));
            Assert.AreEqual(false,
                            SceneNodeView.GetVisible(controller.view.letterButtons[7]));
            Assert.AreEqual(controller.model.promptAndAnswers[0].promptText,
                            TextView.GetText(controller.view.promptAndAnswers[0].promptText));
            Assert.AreEqual(controller.model.empty,
                            TextView.GetText(controller.view.promptAndAnswers[0].answerTexts[0]));
            Assert.AreEqual(true,
                            SceneNodeView.GetVisible(
                                controller.view.promptAndAnswers[0].answers[0]));
            Assert.AreEqual(false,
                            SceneNodeView.GetVisible(
                                controller.view.promptAndAnswers[3].answers[7]));
            Assert.AreEqual(false,
                            SceneNodeView.GetVisible(
                                controller.view.selected.answers[0]));
        }