O'Reilly logo

Practical Test-Driven Development using C# 7 by Clayton Hunt, John Callaway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A new test file

We’ll start by creating a new test file. Let's name this file SpeakerControllerSearchTests.cs. Now, create the first test, ItExists:

[Fact]public void ItExists(){  var controller = new SpeakerController();}

To make this compile, you'll need to create a Web API controller called SpeakerMeetController. Add a new ASP.NET Core Web Application project to your solution. Give your project a name of SpeakerMeet.API and choose the Web API template to get started. Add a reference to this project from your test project and add the appropriate using statement.

Now, let's ensure that there is a Search endpoint available. Let's create another test:

[Fact]public void ItHasSearch(){  // Arrange  var controller = new SpeakerController(); // Act ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required