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); controller.Dispose(); }
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); controller.Dispose(); }