/// <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;
   
    }
   
    }
   
    }
   
    ????????ConnectionFactoryFixture.cs?? ?????????CreateConnection????????????????????????????????
   
    using System;
   
    using System.Text;
   
    using System.Collections.Generic;
   
    using NUnit.Framework;
   
    using Microsoft.Practices.SmartClient.ConnectionMonitor.Implementations;namespace Microsoft.Practices.SmartClient.ConnectionMonitor.Tests
   
    {
   
    /// <summary>
   
    /// Summary description for ConnectionFactoryFixture
   
    /// </summary>
   
    [TestFixture]
   
    public class ConnectionFactoryFixture
   
    {
   
    public ConnectionFactoryFixture????
   
    {
   
    }
   
    [Test]
   
    public void CanCreateDesktopConnection????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"DesktopConnection"?? 1????
   
    Assert.IsNotNull??connection????
   
    Assert.IsTrue??connection is DesktopConnection????
   
    }
   
    [Test]
   
    public void CanCreateNicConnection????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"NicConnection"?? 1????
   
    Assert.IsNotNull??connection????
   
    Assert.IsTrue??connection is NicConnection????
   
    }
   
    [Test]
   
    public void CanCreateWirelessConnection????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"WirelessConnection"?? 1????
   
    Assert.IsNotNull??connection????
   
    Assert.IsTrue??connection is WirelessConnection????
   
    }
   
    [Test]
   
    public void CanCreateWiredConnection????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"WiredConnection"?? 1????
   
    Assert.IsNotNull??connection????
   
    Assert.IsTrue??connection is WiredConnection????
   
    }
   
    [Test]
   
    public void CanCreateMyCustomConnection????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"Microsoft.Practices.SmartClient.ConnectionMonitor.Tests.MyCustomConnection??SmartClient.ConnectionMonitor.Tests"?? 1????
   
    Assert.IsNotNull??connection????
   
    Assert.IsTrue??connection is MyCustomConnection????
   
    }
   
    [Test]
   
    [ExpectedException??typeof??ConnectionMonitorException????]
   
    public void CreateConnectionThrowsWhenPassedBadType????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"BadTypeName"?? 1????
   
    }
   
    [Test]
   
    [ExpectedException??typeof??ArgumentNullException????]
   
    public void CreateConnectionThrowsWhenPassedNullType????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??null?? 1????
   
    }
   
    [Test]
   
    [ExpectedException??typeof??ArgumentException????]
   
    public void CreateConnectionThrowsWhenPassedEmptyType????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??String.Empty?? 1????
   
    }
   
    [Test]
   
    [ExpectedException??typeof??ArgumentOutOfRangeException????]
   
    public void CreateConnectionThrowsWhenPassedNegativePrice????
   
    {
   
    Connection connection = ConnectionFactory.CreateConnection??"WiredConnection"?? -1????
   
    }
   
    }
   
    }
   
    2. NUnit???????????MOCK???????????????????
   
    ??????????????????????Щ????????????????????????????????????????????????????XML?????????????????????
   
    ??????????????????????????????? ????Щ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????顣
   
    ???????и????????????????????????????д????????????????????????????????????????????????????????????λ????????????????????????????????????bug????????????к????????????????????????????????????????????????????????????????????????????С???????????????????????????????????????bug.
   
    ???????????MOCK?????????????????
   
    ???mock??????в?????????????????3?????裬??????
   
    1. ??????????????????????
   
    2. ?????????????????
   
    3. ????????????mock???????????????
   
    ???????????ο???????????????????????????????????????????????????????????????????????????????????????????mock?????????????к???????????????????????Щ????????????????????????