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

Mocking the server

Now that we have fixed our existing tests, we are ready to start writing tests for our real service, the fetchSpeakerService. Let's get started by looking at the test we used for our mock service. The tests will largely be the same as we are trying to achieve the same pattern of functionality.

First, we will want to create the test file fetchSpeakerService.spec.js. Once the file is created, we can add the standard existence test:

describe('Fetch Speaker Service', () => {   it('exits', () => {     expect(FetchSpeakerService).to.exist;   }); });

Because we stubbed out the fetch speaker service earlier, this test should just pass after we add the appropriate import.

Following the mock speaker service tests, the next test is a construction ...

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