在VS 2008中显示单元测试结果

Mic*_*ern 0 c# unit-testing visual-studio-2008

我是一个使用Visual Studio 2008内置单元测试组件的新手,在单元测试中记录或显示结果的最佳方法是什么?

我想在返回System.GUID和空System.GUID时测试我的服务方法

[TestMethod]
public void GetGUID()
{
   MyWcfServiceService.MyWcfServiceClient proxy = new MyWcfServiceService.MyWcfServiceClient();
   string name = "HasGuid";

   System.GUID guid = proxy.GetGUID(name);
}

[TestMethod]
public void GetEmptyGUID()
{
    MyWcfServiceService.MyWcfServiceClient proxy = new MyWcfServiceService.MyWcfServiceClient();
   string name = "HasEmptyGuid";

   System.GUID guid = proxy.GetGUID(name);
}
Run Code Online (Sandbox Code Playgroud)

Ty.*_*Ty. 5

对于GetGUID()......

Assert.IsFalse(guid == Guid.Empty);
Run Code Online (Sandbox Code Playgroud)

同样适用于GetEmptyGUID()......

Assert.IsTrue(guid == Guid.Empty);
Run Code Online (Sandbox Code Playgroud)