コード例 #1
0
        public void GivenMultipleCommandParameters_WhenConverting_ThenItReturnsShallowCopy()
        {
            object[] parameters = new object[] { 3, "string", 14.5M };

            object convertedParams = converterSubject.Convert(parameters, typeof(object), 2, CultureInfo.InvariantCulture);

            Assert.NotEqual(parameters.GetHashCode(), convertedParams.GetHashCode());
        }
コード例 #2
0
        protected override void Invoke(object parameter)
        {
            if (AssociatedObject != null)
            {
                var command = ResolveCommand();

                if (CommandParameterConverter != null)
                {
                    parameter = CommandParameterConverter.Convert(parameter, typeof(object), null,
                                                                  CultureInfo.CurrentCulture);
                }

                if (command?.CanExecute(parameter) == true)
                {
                    command.Execute(parameter);
                }
            }
        }