public void CallButtonAction() { // Arrange WelcomeHUDController controller = Substitute.ForPartsOf <WelcomeHUDController>(); controller.Initialize(new MessageOfTheDayConfig { buttons = new[] { new MessageOfTheDayConfig.Button { action = "action0" }, new MessageOfTheDayConfig.Button { action = "action1" } } }); // Act controller.OnConfirmPressed(1); // Assert controller.Received().SendAction("action1"); controller.Dispose(); }
public void CreateTheView() { // Arrange WelcomeHUDController controller = Substitute.ForPartsOf <WelcomeHUDController>(); // Assert Assert.IsNotNull(controller.view); }
public void ProcessOutOfBoundsButtonsProperly() { // Arrange WelcomeHUDController controller = Substitute.ForPartsOf <WelcomeHUDController>(); controller.Initialize(new MessageOfTheDayConfig { buttons = new MessageOfTheDayConfig.Button[0] }); // Act controller.OnConfirmPressed(-1); controller.OnConfirmPressed(1); // Assert controller.DidNotReceiveWithAnyArgs().SendAction(default);
public void ReactToViewOnButtonConfirm(int buttonIndexToPress) { // Arrange IWelcomeHUDView mockView = Substitute.For <IWelcomeHUDView>(); mockView.When(x => x.Initialize(Arg.Any <UnityAction <int> >(), Arg.Any <UnityAction>(), Arg.Any <MessageOfTheDayConfig>())) .Do(x => x.ArgAt <UnityAction <int> >(0).Invoke(buttonIndexToPress)); WelcomeHUDController controller = Substitute.ForPartsOf <WelcomeHUDController>(); // Act controller.Initialize(null); // Assert controller.Received().OnConfirmPressed(buttonIndexToPress); mockView.Received().SetVisible(false); }
protected override IEnumerator SetUp() { yield return base.SetUp(); controller = new WelcomeHUDController(); controller.Initialize(hasWallet: true); }
public virtual IHUD CreateHUD(HUDElementID hudElementId) { IHUD hudElement = null; switch (hudElementId) { case HUDElementID.NONE: break; case HUDElementID.MINIMAP: hudElement = new MinimapHUDController(); break; case HUDElementID.PROFILE_HUD: hudElement = new ProfileHUDController(); break; case HUDElementID.NOTIFICATION: hudElement = new NotificationHUDController(); break; case HUDElementID.AVATAR_EDITOR: hudElement = new AvatarEditorHUDController(); break; case HUDElementID.SETTINGS_PANEL: hudElement = new SettingsPanelHUDController(); break; case HUDElementID.EXPRESSIONS: hudElement = new ExpressionsHUDController(); break; case HUDElementID.PLAYER_INFO_CARD: hudElement = new PlayerInfoCardHUDController(); break; case HUDElementID.AIRDROPPING: hudElement = new AirdroppingHUDController(); break; case HUDElementID.TERMS_OF_SERVICE: hudElement = new TermsOfServiceHUDController(); break; case HUDElementID.WORLD_CHAT_WINDOW: hudElement = new WorldChatWindowHUDController(); break; case HUDElementID.FRIENDS: hudElement = new FriendsHUDController(); break; case HUDElementID.PRIVATE_CHAT_WINDOW: hudElement = new PrivateChatWindowHUDController(); break; case HUDElementID.TASKBAR: hudElement = new TaskbarHUDController(); break; case HUDElementID.MESSAGE_OF_THE_DAY: hudElement = new WelcomeHUDController(); break; case HUDElementID.OPEN_EXTERNAL_URL_PROMPT: hudElement = new ExternalUrlPromptHUDController(); break; case HUDElementID.NFT_INFO_DIALOG: hudElement = new NFTPromptHUDController(); break; case HUDElementID.TELEPORT_DIALOG: hudElement = new TeleportPromptHUDController(); break; case HUDElementID.CONTROLS_HUD: hudElement = new ControlsHUDController(); break; case HUDElementID.EXPLORE_HUD: hudElement = new ExploreHUDController(); break; case HUDElementID.HELP_AND_SUPPORT_HUD: hudElement = new HelpAndSupportHUDController(); break; case HUDElementID.USERS_AROUND_LIST_HUD: hudElement = new UsersAroundListHUDController(); break; case HUDElementID.GRAPHIC_CARD_WARNING: hudElement = new GraphicCardWarningHUDController(); break; case HUDElementID.BUILDER_IN_WORLD_MAIN: hudElement = new BuildModeHUDController(); break; case HUDElementID.QUESTS_PANEL: hudElement = new QuestsPanelHUDController(); break; case HUDElementID.QUESTS_TRACKER: hudElement = new QuestsTrackerHUDController(); break; case HUDElementID.SIGNUP: hudElement = new SignupHUDController(); break; case HUDElementID.BUILDER_PROJECTS_PANEL: hudElement = new BuilderProjectsPanelController(); break; case HUDElementID.LOADING: hudElement = new LoadingHUDController(); break; case HUDElementID.AVATAR_NAMES: hudElement = new AvatarNamesHUDController(); break; } return(hudElement); }