public void NoSuitableMethodActionForCommandGivesAnError()
		{
			var commandProperty =
				Reflector.Property<ViewModelNoValidActionName>(x => x.ShowChildCommand);

			var methods =
				new CommandConvention()
				.Get(typeof(ViewModelNoValidActionName), commandProperty);

			methods.Errors.Should().Have.Count.EqualTo(2);
		}
		public void GetActionMethodFromViewModelByConvention()
		{
			var methods =
				new CommandConvention()
					.Get(typeof(ViewModel1), Reflector.Property<ViewModel1>(x => x.ShowChildCommand));

			methods.ActionMethod.MethodInfo.Name
				.Should("Cannot find the associated method to the command.").Be.EqualTo("ShowChild");

			methods.CanExecuteMethod.MethodInfo.Name
				.Should("Cannot find the associated can method to the command.").Be.EqualTo("CanShowChild");

			methods.ActionMethod.IsAsync
				.Should("The discovered command should be identified as async.").Be.True();
		}
示例#3
0
		public CommandsDiscover(ICommandFactory commandFactory, CommandConvention commandConvention)
		{
			this.commandFactory = commandFactory;
			this.commandConvention = commandConvention;
		}
示例#4
0
		public CommandsDiscover(CommandConvention commandConvention) : this(new CommandFactory(), commandConvention)
		{
		}