Michael Kniskern
Michael Kniskern

Reputation: 25280

Displaying unit test results in VS 2008

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);
}

Upvotes: 0

Views: 382

Answers (2)

Ty.
Ty.

Reputation: 2220

For GetGUID()...

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

Similarly for GetEmptyGUID()...

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

Upvotes: 5

cfeduke
cfeduke

Reputation: 23236

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.

Upvotes: 0

Related Questions