Exemple #1
0
        public void ConvertWithNonCommandObject()
        {
            var converter      = new CommandToToolTipTextConverter();
            var convertedValue = converter.Convert(new object(), null, null, null);

            Assert.AreEqual(string.Empty, convertedValue);
        }
Exemple #2
0
        public void ConvertWithNullReference()
        {
            var converter      = new CommandToToolTipTextConverter();
            var convertedValue = converter.Convert(null, null, null, null);

            Assert.AreEqual(string.Empty, convertedValue);
        }
        public void ConvertWithCommandWithoutKeyGestures()
        {
            var text = "a";
            var name = "b";
            var command = new RoutedUICommand(text, name, typeof(Window));

            var converter = new CommandToToolTipTextConverter();
            var convertedValue = converter.Convert(command, null, null, null);

            Assert.AreEqual(text, convertedValue);
        }
Exemple #4
0
        public void ConvertWithCommandWithoutKeyGestures()
        {
            var text    = "a";
            var name    = "b";
            var command = new RoutedUICommand(text, name, typeof(Window));

            var converter      = new CommandToToolTipTextConverter();
            var convertedValue = converter.Convert(command, null, null, null);

            Assert.AreEqual(text, convertedValue);
        }
        public void ConvertWithCommand()
        {
            var text = "a";
            var name = "b";

            var gestures = new InputGestureCollection(
                new List<InputGesture>
                {
                    new KeyGesture(Key.A, ModifierKeys.Alt),
                });
            var command = new RoutedUICommand(text, name, typeof(Window), gestures);

            var converter = new CommandToToolTipTextConverter();
            var convertedValue = converter.Convert(command, null, null, null);

            var expected = string.Format(
                CultureInfo.CurrentCulture,
                "{0} ({1})",
                text,
                "Alt+A");
            Assert.AreEqual(expected, convertedValue);
        }
Exemple #6
0
        public void ConvertWithCommand()
        {
            var text = "a";
            var name = "b";

            var gestures = new InputGestureCollection(
                new List <InputGesture>
            {
                new KeyGesture(Key.A, ModifierKeys.Alt),
            });
            var command = new RoutedUICommand(text, name, typeof(Window), gestures);

            var converter      = new CommandToToolTipTextConverter();
            var convertedValue = converter.Convert(command, null, null, null);

            var expected = string.Format(
                CultureInfo.CurrentCulture,
                "{0} ({1})",
                text,
                "Alt+A");

            Assert.AreEqual(expected, convertedValue);
        }
 public void ConvertWithNullReference()
 {
     var converter = new CommandToToolTipTextConverter();
     var convertedValue = converter.Convert(null, null, null, null);
     Assert.AreEqual(string.Empty, convertedValue);
 }
 public void ConvertWithNonCommandObject()
 {
     var converter = new CommandToToolTipTextConverter();
     var convertedValue = converter.Convert(new object(), null, null, null);
     Assert.AreEqual(string.Empty, convertedValue);
 }