Web Service Tests

Finally, we get to the point of hooking the whole thing up and using the functionality that we built previously through the Web service. The first test we will write is to verify the id field, just as we did previously with the stub and database versions. We will need a Recording inserted into the database just as we did with the database tests. Here is the first test:

[TestFixture]
public class CatalogGatewayFixture : RecordingFixture
{
   private CatalogGateway gateway = new CatalogGateway();
   private ServiceGateway.RecordingDto dto;

   [SetUp]
   public new void SetUp()
   {
      base.SetUp();
      dto = gateway.FindByRecordingId(Recording.Id);
   }

   [Test]
   public void Id()
   {
      Assert.AreEqual(Recording.Id, dto.id);
   }
}

As you can see, the tests do follow ...

Get Test-Driven Development in Microsoft® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.