????3. ?????????????κκ???????????????????????????????????????????????????????????

????4. ?????????????????????????????????????????????????????????????????????????UI??????????????

????????????????????е??????????????????????????в??????????????????????????????????????????? ??Щ????????????е????????????? ??????????е????????Э????????????????????в??????????????е????з????????????????????????????Щ?????????????????и?????????????????????????????????????????????????????????????????????????

????????????д???????????д?????????????????????TDD??????д?????????????????д???庯??????????????????????

?????й???????

????д????????????????????????л????????????????????????????????????Щ???в??????????????????????????????????????????????????????????????????????????????????????????????????л??????????д????????

??????????????????????????????????????????????????ζ????????????????????????????????????????????ν????Ч????????????????????????????????????????Schedule??????????????

??????????μ????????

????Web????????????????Presentation???????????Controller??????????????

????????????Business Logic??????????????????????????????????????????????????????????MOCK???????????????????????????????????????????????????

????????????Data Access Logic???? ????????

?????????棨AOP???????????????????????

??????????????????????

????CppUnit??????C++?????????????棬????????????????.

????C++Test??????Parasoft???????????C++Test??????????????????C/C++?????????????????????????κ?C/C++??????????????????????????????????????????????????????????????????????????????????????????Visual Unit?????VU???????????????????????????????????????????????μ???????????????????????????ú???á?

????NUnit???????????????????????????.NET??д??

????JUnit?????Java?????????????java?μ?team ????????cvs???汾????? + ant?????????? + junit?????????? ????????????ant????????????????????????????

?????????????????

????1. NUnit??????????????????????????????????????

???????????ConnectionFactory.cs??????????CreateConnection?????????

using System;
using Microsoft.Practices.SmartClient.ConnectionMonitor.Implementations;
namespace Microsoft.Practices.SmartClient.ConnectionMonitor
{
    /// <summary>
    /// A simple factory that can create <see cref="Connection"/> objects.
    /// </summary>
    public class ConnectionFactory
    {
        /// <summary>
        /// DesktopConnection
        /// </summary>
        public const string DesktopConnection = "DesktopConnection";

        /// <summary>
        /// NicConnection
        /// </summary>
        public const string NicConnection = "NicConnection";

        /// <summary>
        /// WirelessConnection
        /// </summary>
        public const string WirelessConnection = "WirelessConnection";

        /// <summary>
        /// WiredConnection
        /// </summary>
        public const string WiredConnection = "WiredConnection";

        /// <summary>
        /// Creates a <see cref="Connection"/> object.
        /// </summary>
        /// <param name="connectionType">The type of the connection to create.</param>
        /// <param name="price">The price of the <see cref="Connection"/>.</param>
        /// <returns>A <see cref="Connection"/> object.</returns>
        /// <exception cref="ConnectionMonitorException">Thrown when an invalid type is requested.</exception>
        /// <remarks>
        /// For the built-in <see cref="Connection"/> types
        /// (i.e. DesktopConnection?? NicConnection?? WirelessConnection?? WiredConnection)??
        /// only the class name is required.  For user created types?? the fully qualified
        /// class name is required.
        /// </remarks>
        public static Connection CreateConnection(string connectionType?? int price)
        {
            Guard.StringNotNullOrEmpty(connectionType?? "connectionType");
           
            if (price < 0)
            {
                throw new ArgumentOutOfRangeException("price");
            }

            Connection connection;
            switch (connectionType)
            {
                case DesktopConnection:
                    connection = new DesktopConnection(DesktopConnection?? price);
                    break;
                case NicConnection:
                    connection = new NicConnection(NicConnection?? price);
                    break;
                case WirelessConnection:
                    connection = new WirelessConnection(WirelessConnection?? price);
                    break;
                case WiredConnection:
                    connection = new WiredConnection(WiredConnection?? price);
                    break;
                default:
                    try
                    {
                        Type connectionTypeToCreate = Type.GetType(connectionType?? true);
                        Object createdObject = Activator.CreateInstance(connectionTypeToCreate?? connectionTypeToCreate.Name?? price);
                        connection = createdObject as Connection;
                    }
                    catch(TypeLoadException ex)
                    {
                        throw new ConnectionMonitorException("Unsupported connection type."?? ex);
                    }
                   
                    if (connection == null)
                    {
                        throw new ConnectionMonitorException("Unsupported connection type.");
                    }
                    break;
            }
            return connection;
        }

    }
}