Click here to Skip to main content
15,891,184 members
Articles / Desktop Programming / WPF

Catel - Part 4 of n: Unit testing with Catel

Rate me:
Please Sign up or sign in to vote.
4.55/5 (10 votes)
28 Jan 2011CPOL11 min read 49K   572   11  
This article explains how to write unit tests for MVVM using Catel.
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WindowCommands.cs" company="Catel development team">
//   Copyright (c) 2008 - 2011 Catel development team. All rights reserved.
// </copyright>
// <summary>
//   Window commands.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Windows.Input;

namespace Catel.Windows.Input
{
    /// <summary>
    /// Window commands.
    /// </summary>
    public static class WindowCommands
    {
        /// <summary>
        /// Initializes the static members of the <see cref="WindowCommands"/> class.
        /// </summary>
        static WindowCommands()
        {
            // Reset layout
            ResetLayout = new RoutedUICommand(Properties.Resources.CommandWindowResetLayout, "ResetLayout", typeof(WindowCommands));

            // Refresh
            InputGestureCollection refreshGestures = new InputGestureCollection();
            refreshGestures.Add(new KeyGesture(Key.F5, ModifierKeys.None));
            Refresh = new RoutedUICommand(Properties.Resources.CommandWindowRefresh, "Refresh", typeof(WindowCommands), refreshGestures);

            // Clear
            Clear = new RoutedUICommand(Properties.Resources.CommandWindowClear, "Clear", typeof(WindowCommands));

            // OK
            InputGestureCollection okGestures = new InputGestureCollection();
            OK = new RoutedUICommand(Properties.Resources.CommandWindowOK, "OK", typeof(WindowCommands), okGestures);

            // Apply
            Apply = new RoutedUICommand(Properties.Resources.CommandWindowApply, "Apply", typeof(WindowCommands));

            // Cancel
            InputGestureCollection cancelGestures = new InputGestureCollection();
            cancelGestures.Add(new KeyGesture(Key.Escape, ModifierKeys.None));
            Cancel = new RoutedUICommand(Properties.Resources.CommandWindowCancel, "Cancel", typeof(WindowCommands), cancelGestures);

            // Close
            InputGestureCollection closeGestures = new InputGestureCollection();
            closeGestures.Add(new KeyGesture(Key.Escape, ModifierKeys.None));
            Close = new RoutedUICommand(Properties.Resources.CommandWindowClose, "Close", typeof(WindowCommands));

			// Copy to clipboard
			CopyToClipboard = new RoutedUICommand(Properties.Resources.CommandWindowCopyToClipboard, "CopyToClipboard", typeof(WindowCommands));
        }

        /// <summary>
        /// Reset layout
        /// </summary>
        public static RoutedUICommand ResetLayout { get; private set; }

        /// <summary>
        /// Refresh.
        /// </summary>
        public static RoutedUICommand Refresh { get; private set; }

        /// <summary>
        /// Clear.
        /// </summary>
        public static RoutedUICommand Clear { get; private set; }

        /// <summary>
        /// OK.
        /// </summary>
        public static RoutedUICommand OK { get; private set; }

        /// <summary>
        /// Apply.
        /// </summary>
        public static RoutedUICommand Apply { get; private set; }

        /// <summary>
        /// Cancel.
        /// </summary>
        public static RoutedUICommand Cancel { get; private set; }

        /// <summary>
        /// Close.
        /// </summary>
        public static RoutedUICommand Close { get; private set; }

        /// <summary>
		/// Copy to clipboard.
        /// </summary>
        public static RoutedUICommand CopyToClipboard { get; private set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions