Click here to Skip to main content
15,880,725 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.3K   54   41  
A few simple tips that should help when you are considering setting up CI
// WARNING: This file has been generated. Any manual changes must be made within preserved regions or they will be lost.

//===============================================================================
//
// AssembliesTests
//
// PURPOSE: 
// Tests the functionality of Assemblies.
//
// NOTES: 
// 
//
//===============================================================================
//
// Copyright (C) 2003 Wallis Software Solutions
// All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
//
//===============================================================================

using System.Reflection;
using NUnit.Framework;

namespace Agile.Common.Reflections.Tests
{
    /// <summary>
    /// Tests the functionality of Assemblies.
    /// </summary>
    [TestFixture]
    public class AssembliesTests
    {
        /// <summary>
        /// Verifies All assemblies are loaded when requested
        ///     - Check the array contains one of our items, Common
        ///     - Check the array contains nunit
        ///     - Check the array contains System
        /// </summary>
        [Test]
        public void AllAssembliesTests()
        {
            // Check all loaded assemblies contains Common
            Assert.IsTrue(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.AllLoadedAssemblies
                                                           , "Agile.Common")
                          , "Check all loaded assemblies contains Common");

            // Check all loaded assemblies contains nunit.framework
            Assert.IsTrue(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.AllLoadedAssemblies
                                                           , "nunit.framework")
                          , "Check all loaded assemblies contains nunit.framework");

            // Check all loaded assemblies contains System
            Assert.IsTrue(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.AllLoadedAssemblies
                                                           , "System")
                          , "Check all loaded assemblies contains System");
        }

        /// <summary>
        /// Verifies GetAssemblyNamed returns the required assembly
        ///     - use GetAssemblyNamed to get Agile.Common from OurAssemblies
        ///     - Check the assembly 
        ///     - use GetAssemblyNamed to get nunit.framework from AllAssemblies
        ///     - check the assembly
        /// </summary>
        [Test]
        public void GetAssemblyNamedTests()
        {
            // use GetAssemblyNamed to get Agile.Common from OurAssemblies
            Assembly common = Assemblies.GetAssemblyNamed(Assemblies.Instance.OurAssemblies, "Agile.Common");
            // Check the assembly is not null
            Assert.IsNotNull(common, "Check the assembly is not null");
            // use GetAssemblyNamed to get nunit.framework from AllAssemblies
            Assembly nunit = Assemblies.GetAssemblyNamed(Assemblies.Instance.AllLoadedAssemblies, "nunit.framework");
            // check the assembly
            Assert.IsNotNull(nunit, "Check the assembly is not null");
        }

        /// <summary>
        /// Verifies our assemblies return the right array of assemblies
        ///     - Check the array contains Agile.Common
        ///     - Check the array shouldn't contain Agile.WinUI
        ///     - Check the array contains Agile.Testing
        ///     - Check the array does not contain nunit
        ///     - Check the array does not contain System
        /// </summary>
        [Test]
        public void OurAssembliesTests()
        {
            // Check the array contains Agile.Common
            Assert.IsTrue(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.OurAssemblies
                                                           , "Agile.Common")
                          , "Check all loaded assemblies contains Agile.Common");

            // Check the array shouldn't contain Agile.UI
            Assert.IsFalse(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.OurAssemblies
                                                            , "Agile.WinUI")
                           , "Check all loaded assemblies shouldn't contain Agile.WinUUI");

            // Check the array does not contain nunit
            Assert.IsFalse(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.OurAssemblies
                                                            , "nunit.framework")
                           , "Check the array does not contain nunit");

            // Check the array does not contain System
            Assert.IsFalse(Assemblies.ContainsAssemblyNamed(Assemblies.Instance.OurAssemblies
                                                            , "System")
                           , "Check the array does not contain System");
        }
    }
}

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