コード例 #1
0
 private ICommand GetCommandTest()
 {
     return(CommandBuilderProvider.Get("CommandTest")
            .Execute(async ct => await _asyncMessageDialog.Show(ct, "Hello", "From settings flyout"))
            .Error((token, exception) => Task.FromResult(true))
            .ToCommand());
 }
コード例 #2
0
 private ICommand GetSettingCommand2()
 {
     return(CommandBuilderProvider.Get("SettingCommand2")
            .Execute(async ct => await Services.RequestNavigation.Navigate(ct, ApplicationPages.SettingsFlyoutTest))
            .Error((token, exception) => Task.FromResult(true))
            .ToCommand());
 }
コード例 #3
0
 private ICommand GetSettingCommand1()
 {
     return(CommandBuilderProvider.Get("SettingCommand1")
            .Execute(async ct => await _messageDialog.Show(ct, "Hello", "From the settings charm bar"))
            .Error((token, exception) => Task.FromResult(true))
            .ToCommand());
 }
コード例 #4
0
        public void Get_UsingDefaultBuilderFactory_ShouldReturnCorrectValue(
            string name,
            ISchedulers schedulers)
        {
            //arrange
            var sut = new CommandBuilderProvider(schedulers);

            //act
            var actual = sut.Get(name);

            //assert
            actual.Should().NotBeNull().And.BeOfType <CommandBuilder>();
        }
コード例 #5
0
        public void Get_UsingBuilderFactory_ShouldReturnCorrectValue(
            string name,
            ISchedulers schedulers,
            ICommandBuilder expected)
        {
            //arrange
            var sut = new CommandBuilderProvider(schedulers, (action, schedulers1, arg3) => expected);

            //act
            var actual = sut.Get(name);

            //assert
            actual.Should().Be(expected);
        }
コード例 #6
0
        public void Get_ShouldCallAccept(
            string name,
            ISchedulers schedulers,
            Mock <ICommandBuilder> commandBuilder,
            Mock <IMvvmCommand> command,
            IMvvmCommandVisitor visitor)
        {
            //arrange
            Action <ICommand> action = null;
            var sut = new CommandBuilderProvider(schedulers, (action1, schedulers1, n) =>
            {
                action = action1;
                return(commandBuilder.Object);
            });

            sut.AddVisitor(visitor);

            //act
            sut.Get("");
            action(command.As <ICommand>().Object);

            //assert
            command.Verify(c => c.Accept(visitor));
        }