title: Error: StaticInjectorError(DynamicTestModule)[CityService -> Http]: No provider for Http
body: <p>I have this service that return all City from ws.</p>
  
  <pre><code>@Injectable()
  export class CityService {
    constructor(private http: Http, private router: Router,
    private auth: AuthService) { }
  
    public getAllCity(): Observable&lt;City[]&gt; {
      let headers = new Headers();
      headers.append('x-access-token', this.auth.getCurrentUser().token);
      return this.http.get(Api.getUrl(Api.URLS.getAllCity), {
        headers: headers
      })
        .map((response: Response) =&gt; {
          let res = response.json();
          if (res.StatusCode === 1) {
            this.auth.logout();
          } else {
            return res.StatusDescription.map(city =&gt; {
              return new City(city);
            });
          }
        });
    }
  }
  </code></pre>
  
  <p>Now, I tried this code to test my service. In this post I want to know, How to test this service <code>CityService</code></p>
  
  <pre><code>describe('Service: City', () =&gt; {
      let component: CityService;
      let fixture: ComponentFixture&lt;CityService&gt;;
  
      beforeEach(() =&gt; {
          TestBed.configureTestingModule({
              declarations: [],
              providers: [CityService] 
          })
          fixture = TestBed.get(CityService);
          component = fixture.componentInstance;
      });
     it('#getAllCity should return real value', () =&gt; {
       expect(component.getAllCity()).toBe('real value');
    });
  });
  </code></pre>
  
  <p>I tried this code, but show me error: </p>
  
  <blockquote>
    <p>Error: StaticInjectorError(DynamicTestModule)[CityService -> Http]:<br>
    StaticInjectorError(Platform: core)[CityService -> Http]: 
        NullInjectorError: No provider for Http!</p>
  </blockquote>
  
  <p>How to test / how to show my city in <code>ng test</code>? </p>
  
  <p>This is my first attempt, can you suggest me any example, or tutorial like my code?</p>