Click here to Skip to main content
15,885,782 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 48.9K   572   11  
This article explains how to write unit tests for MVVM using Catel.
using System;
using Catel.Articles.Base.UI.Windows;

namespace Catel.Articles.Base.Data.Attributes
{
    /// <summary>
    /// Attribute to decorate an example class so it is automatically included in the examples collection of
    /// the <see cref="ExamplesWindow"/>.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class ExampleAttribute : Attribute
    {
        #region Variables
        #endregion

        #region Constructor & destructor
        /// <summary>
        /// Initializes a new instance of the <see cref="ExampleAttribute"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="shortDescription">The short description.</param>
        public ExampleAttribute(string name, string shortDescription)
        {
            // Store values
            Name = name;
            ShortDescription = shortDescription;
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; private set; }

        /// <summary>
        /// Gets the short description.
        /// </summary>
        /// <value>The short explanation.</value>
        public string ShortDescription { get; private set; }

        /// <summary>
        /// Gets or sets the long description.
        /// </summary>
        /// <value>The large explanation.</value>
        public string LongDescription { get; set; }

        /// <summary>
        /// Gets or sets the image Uri. This Uri will be used to show an image. If the Uri is <c>null</c>, no image will
        /// be shown with the example.
        /// </summary>
        /// <value>The image Uri.</value>
        public string ImageUri { get; set; }

        /// <summary>
        /// Gets or sets the relative file name of the code.
        /// </summary>
        /// <value>The relative file name of the code.</value>
        public string SourceFileName { get; set; }

        /// <summary>
        /// Gets or sets the name of the click handler.
        /// </summary>
        /// <value>The name of the click handler.</value>
        public string ClickHandlerName { get; set; }
        #endregion

        #region Methods
        #endregion
    }
}

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