views:

226

answers:

2

I am a rookie was using the Visual Studio 2008 built-in Unit Testing components, what would be the best way to record or display your results in a unit test?

I want to test my service method when it returns a System.GUID and an empty 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);
}
A: 

I used this for a few months last year, IIRC isn't there an Assert class? Assert.IsTrue(...)?

I've dropped VS test stuff in favor of other unit test frameworks (better IMO) so my memory is likely clouded.

cfeduke
Yeah its Assert.IsTrue(condition, "a message") or Assert.XXX(x, "a message").
cfeduke
+5  A: 

For GetGUID()...

Assert.IsFalse(guid == Guid.Empty);

Similarly for GetEmptyGUID()...

Assert.IsTrue(guid == Guid.Empty);
Ty