实验四 单元测试2

慢漫曼蔓 / 2023-05-07 / 原文

一、实验目的

1、 掌握单元测试技术,并按单元测试的要求设计测试用例。 

2、 掌握一种单元测试工具的使用。

二、实验内容

自行学习vs2010或vs2012或vs2015等单元测试工具的使用。

对下面被测代码进行测试且查看代码覆盖率,并录制操作视频,撰写实验报告。

   public class Cmp
             { 
              public static int Largest (int[] list)
                {
 
                 if(list.Length ==0)
                    throw new ArgumentException("Empty List");
                 int index,max=Int32.MinValue;
                 for(index =0;index<list.Length; index++)
                 {
                   if(list[index]>max)
                  max=list[index];
                 }
                  return max;
                }
              }