Click here to Skip to main content
15,896,111 members
Articles / Web Development / ASP.NET

Secrets for Setting Up Continuous Integration

Rate me:
Please Sign up or sign in to vote.
2.88/5 (7 votes)
23 Feb 2009CPOL5 min read 65.7K   54   41  
A few simple tips that should help when you are considering setting up CI
namespace Agile.Common
{
    /// <summary>
    /// Essentially an extended 'bool' for when you want to know
    /// details of why something failed.
    /// </summary>
    /// <example>
    /// public ActionResult Validate()
    /// {
    ///		if(RequiredField == null)
    ///		{
    ///			return ActionResult.Failed("RequiredField is mandatory");
    ///		}
    ///		return ActionResult.Success;
    /// }
    /// </example>
    public class ActionResult
    {
        /// <summary>
        /// The reason why the action failed.
        /// </summary>
        private readonly string _failureReason;

        /// <summary>
        /// Action result constructor.
        /// </summary>
        /// <param name="reason">Reason for failure. Set to null when the action was successful.</param>
        private ActionResult(string reason)
        {
            _failureReason = reason;
        }

        /// <summary>
        /// Instantiate a successful action result.
        /// </summary>
        public static ActionResult Success
        {
            get { return new ActionResult(null); }
        }

        /// <summary>
        /// Gets the reason why the action failed.
        /// </summary>
        public string FailureReason
        {
            get { return _failureReason; }
        }

        /// <summary>
        /// Returns true if the action was successful.
        /// </summary>
        public bool WasSuccessful
        {
            get { return _failureReason == null; }
        }

        /// <summary>
        /// Instantiate a failed action result with the reason for the failure.
        /// </summary>
        /// <param name="reason">Why the action failed.</param>
        /// <returns></returns>
        public static ActionResult Failed(string reason)
        {
            return new ActionResult(reason);
        }
    }
}

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 (Senior) Peer Placements Pty Ltd
Australia Australia
I live in Sydney and have been a developer for almost a decade now. I have a passion for technology and a strong interest in discovering 'better, cleaner, faster' ways to get systems out the door because I believe software development takes too long. If I have an idea I want to realise it as quickly as possible...plus writing systems for someone else I want to deliver quickly so I can move onto the next interesting project!

Comments and Discussions