1.
      
      
      
     
    
    
     
      新建
     
     
      
       test Project
      
     
    
   
    
     
      
     
    
   
    
    
   
    
     
      
       
      
     
    
   
    
     
     
    
   
    
     
      
       2.
      
      
      
     
    
    
     
      在
     
     
      
       solution
      
     
     
      中添加要进行单元测试的
     
     
      
       project
      
     
    
   
    
     
     
    
   
    
    
   
    
     
      
       3.
      
      
      
     
    
    
     
      在
     
     
      
       test Project
      
     
     
      上点击右键,选择添加“
     
     
      
       Unit Test
      
     
     
      ”
     
    
   
    
     
      
       
        
       
      
     
    
   
    
    
   
    
     
     
    
   
    
     
      
       4.
      
      
      
     
    
    
     
      选择需要进行单元测试的
     
     
      
       project
      
     
     
      ,可以一直选择到需要进行的方法上。
     
    
   
    
     
      
       
        
       
      
     
    
   
    
     
      
      
     
    
   
    
     
      
       
        
         
        
       
      
     
    
   
    
     
      
      
     
    
   
    
     
      5.
      
      
     
    
    
     
      
       VS 2008 Team suit
      
     
     
      会自动生成一系列代码,我们只需要去掉冗余的代码,给相应的参数赋值即可
     
    
   
    
     
      
///A test for Handle
///</summary>
[TestMethod()]
public void HandleTest()
{
RaRDeployHandler target = new RaRDeployHandler(); // TODO: Initialize to an appropriate value
//string filePath = string.Empty; // TODO: Initialize to an appropriate value
//string tagFolder = string.Empty; // TODO: Initialize to an appropriate value
string filePath = @”E:/My Programs/SCROM/7zip.rar”;
string tagFolder = @”E:/My Programs/SCROM/abc/”;
bool actual;
actual = target.Handle(filePath, tagFolder);
 }
     
    
   
    
    
   
    
    
   
    
    
    
     
      
       6.
      
      
      
     
    
    
     
      执行测试
     
    
   
    
     
      
       (1)
      
      
      
     
    
    
     
      当前窗口是测试文件,点击右上角的
     
     
      
       Debug Test
      
     
    
   
    
     
      
       
        
       
      
     
    
   
    
     
      
       (2)
      
      
      
     
    
    
     
      在
     
     
      
       test Project
      
     
     
      点击右键
     
     
      
       —Debug – start new instance
      
     
    
   
    
     
      
     
    
   
    
     
     
    
   
    
     
      
       7.
      
      
      
     
    
    
     
      添加断点,逐步及逐过程调试执行。
     
    
   
    
     
      
       8.
      
      
      
     
    
    
     
      测试结果所在位置:
     
    
   
    
     
      …/TestResults
     
    
   
    
    
   
    
     
    
   
    
     
     
    
   
    
     
      
       Reference:
      
     
    
   
    
     
     
    
   
    
     
      演练:使用
     
     
      Visual Studio Team Test
     
     
      进行单元测试
     
     
     
    
   
    
     
      
       http://msdn.microsoft.com/zh-cn/library/ms379625(VS.80).aspx
      
     
     
     
    
   
 
