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();
        }
Esempio n. 2
0
        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);
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 protected override IEnumerator SetUp()
 {
     yield return base.SetUp();
     controller = new WelcomeHUDController();
     controller.Initialize(hasWallet: true);
 }