title: Angular2 service testing : inject a dependency with beforeEach
body: <p>I am testing services with an <code>Http</code> dependency. Every test looks like this : </p>
  
  <pre><code>import { TestBed, async, inject } from '@angular/core/testing';
  import { ValidationService } from './validation.service';
  import { HttpModule, Http, Response, ResponseOptions, RequestOptions, Headers, XHRBackend } from '@angular/http';
  import { MockBackend, MockConnection } from '@angular/http/testing';
  
  describe('DashboardService', () =&gt; {
    beforeEach(() =&gt; {
      TestBed.configureTestingModule({
        imports: [HttpModule],
        providers: [
          ValidationService,
          { provide: XHRBackend, useClass: MockBackend }
        ]
      });
    });
  
    it('should ...',
      inject([ValidationService, XHRBackend],
        (service: ValidationService, mockBackEnd: MockBackend) =&gt; {
          mockBackEnd.connections.subscribe((connection: MockConnection) =&gt; {
            connection.mockRespond(new Response(new ResponseOptions({
              body: JSON.stringify('content')
            })));
          });
        }));
        // assertions ...
  });
  </code></pre>
  
  <p>As you can see, I need to inject the BackEnd mock at every it. </p>
  
  <p>Is it possible to use a <code>beforeEach</code> to inject the dependency before every test ? </p>