Exemplo n.º 1
0
        public void OnClicked()
        {
            var commandExecuterMock         = new Mock <ICommandExecutor>();
            var command                     = new Mock <ICommand>().Object;
            var commandParameter            = new object();
            var eventArgs                   = new EventArgs();
            var eventArgsConverter          = new Mock <IValueConverter>().Object;
            var eventArgsConverterParameter = new object();
            var eventArgsPropertyPath       = "";

            var button =
                new ActionSheetButton()
            {
                CommandExecutor             = commandExecuterMock.Object,
                Command                     = command,
                CommandParameter            = commandParameter,
                EventArgsConverter          = eventArgsConverter,
                EventArgsConverterParameter = eventArgsConverterParameter,
                EventArgsPropertyPath       = eventArgsPropertyPath
            };

            button.OnClicked(this, eventArgs);

            commandExecuterMock.Verify(
                executer => executer.Execute(command, commandParameter, eventArgs, eventArgsConverter, eventArgsConverterParameter, eventArgsPropertyPath),
                Times.Once);
        }
Exemplo n.º 2
0
        public void OnClicked_WhenInvokeAction()
        {
            var called = false;
            var action = new ActionSheetButton {
                Action = () => { called = true; }
            };

            action.OnClicked(this, EventArgs.Empty);

            Assert.True(called);
        }
Exemplo n.º 3
0
        public void OnClicked_WhenInvokeAction_WithParameter()
        {
            var    actual   = "parameter";
            string expected = null;
            var    action   = new ActionSheetButton <string> {
                Parameter = actual, Action = x => { expected = actual; }
            };

            action.OnClicked(this, EventArgs.Empty);

            Assert.Equal(expected, actual);
        }