예제 #1
0
        public async Task TwoWay_Command_Round_Trip()
        {
            _Command = new RelaySimpleCommand(() =>
            {
                _DataContext.MainSkill = new Skill();
                _DataContext.Skills.Add(_DataContext.MainSkill);
            });

            _DataContext.TestCommand = _Command;
            var test = new TestInContextAsync()
            {
                Bind = (win) => HtmlBinding.Bind(win, _DataContext, JavascriptBindingMode.TwoWay),
                Test = async(mb) =>
                {
                    var js = mb.JsRootObject;

                    _DataContext.Skills.Should().HaveCount(2);

                    await DoSafeAsyncUIFullCycle(() =>
                    {
                        _Command.Execute(null);
                    });

                    var res = await GetCollectionAttributeAsync(js, "Skills");

                    res.Should().NotBeNull();
                    res.GetArrayLength().Should().Be(3);
                }
            };

            await RunAsync(test);
        }
예제 #2
0
        public void Execute_with_object_argument_does_not_call_action_if_type_mismatch()
        {
            var action             = Substitute.For <Action <int> >();
            var relaySimpleCommand = new RelaySimpleCommand <int>(action);

            relaySimpleCommand.Execute(null);
            action.DidNotReceive().Invoke(Arg.Any <int>());
        }
        public void RelaySimpleCommandShouldCallAction()
        {
            var action = Substitute.For <Action>();
            var target = new RelaySimpleCommand(action);
            var arg    = new object();

            target.Execute(arg);

            action.Received(1).Invoke();
        }
예제 #4
0
 public void Execute_without_generic_argument_call_action(string parameter)
 {
     _RelaySimpleCommand.Execute(parameter);
     _Action.Received(1).Invoke(parameter);
 }
예제 #5
0
        public void Execute_without_argument_call_action()
        {
            _RelaySimpleCommand.Execute();

            _Action.Received(1).Invoke();
        }