Exemple #1
0
        public IEnumerator GenerateSectionsIntoThePanelViewCorrectly()
        {
            // Arrange
            SettingsSectionView sectionViewPrefab = ((GameObject)Resources.Load(SECTION_VIEW_PREFAB_PATH)).GetComponent <SettingsSectionView>();
            SettingsButtonEntry menuButtonPrefab  = ((GameObject)Resources.Load(MENU_BUTTON_PREFAB_PATH)).GetComponent <SettingsButtonEntry>();

            SettingsSectionModel newSectionConfig = ScriptableObject.CreateInstance <SettingsSectionModel>();

            newSectionConfig.icon              = Sprite.Create(new Texture2D(10, 10), new Rect(), new Vector2());
            newSectionConfig.text              = "TestSection";
            newSectionConfig.menuButtonPrefab  = menuButtonPrefab;
            newSectionConfig.sectionPrefab     = sectionViewPrefab;
            newSectionConfig.sectionController = ScriptableObject.CreateInstance <SettingsSectionController>();
            newSectionConfig.widgets           = new SettingsWidgetList();

            sectionsToCreate.Add(newSectionConfig);

            // Act
            panelView.Initialize(hudController, panelController, sectionsToCreate);
            yield return(null);

            // Assert
            panelController.Received(1)
            .AddSection(
                Arg.Any <SettingsButtonEntry>(),
                Arg.Any <ISettingsSectionView>(),
                Arg.Any <ISettingsSectionController>(),
                Arg.Any <SettingsSectionModel>());

            panelController.Received(1).OpenSection(0);
            panelController.Received(1).MarkMenuButtonAsSelected(0);
        }
Exemple #2
0
        private IEnumerator SetUp()
        {
            sectionView       = Object.Instantiate((GameObject)Resources.Load(SECTION_VIEW_PREFAB_PATH)).GetComponent <SettingsSectionView>();
            sectionController = Substitute.For <ISettingsSectionController>();

            yield return(null);
        }