Exemplo n.º 1
0
		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);
		}
Exemplo n.º 2
0
		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();
		}
Exemplo n.º 3
0
		public CommandsDiscover(ICommandFactory commandFactory, CommandConvention commandConvention)
		{
			this.commandFactory = commandFactory;
			this.commandConvention = commandConvention;
		}
Exemplo n.º 4
0
		public CommandsDiscover(CommandConvention commandConvention) : this(new CommandFactory(), commandConvention)
		{
		}