title: Angular 4 component unit test cannot resolve all parameters (?)
body: <p>I'm trying to unit test my component but the basic test fails.<br>
  <code>cannot resolve all parameters for MyComponent(?.)</code></p>
  
  <p>I tried adding forwardRef() in my component's constructor it works though. But i do not want to use it just because of test failure and it is not recommended.  </p>
  
  <p><em>please ignore if there are any typo. i've added the code snippet</em>. sorry that i cannot add the actual code here.</p>
  
  <p>src<br>
      ./services<br>
      <strong>my-service-c.ts</strong></p>
  
  <pre><code>import { MyServiceQ } from './my-service-q';
      ...
      @Injectable()
      export class MyServiceC {
          constructor(private myServiceQ: MyServiceQ) { }
          ...
          getMyServiceQ(){
              return this.myServiceQ;
          }
      }
  </code></pre>
  
  <p>./components<br>
      <strong>my-component.ts</strong></p>
  
  <pre><code>import { MyServiceC } from '../services/my-service-c';
      @Component() {...}
      export class MyComponent {
          private myServiceQ;
          constructor(private myServiceC: MyServiceC) {
              this.myServiceQ = this.myServiceC.getMyServiceQ();
          }
      }
  </code></pre>
  
  <p><strong>my-component.spec.ts</strong></p>
  
  <pre><code>import { MyServiceC } from '../services/my-service-c';
      import { MockMyServiceC } from '../fixtures/mock-my-service-c';
      import { MyComponent } from './my-component';
      ..other imports...
  
      beforeEach( () =&gt; {
          TestBed.configureTestingModule({
              providers: [
                  { provide: MyServiceC, useClass: MockMyServiceC }
              ],
              declarations: [ MyComponent ]
          });
          fixture = TestBed.createComponent(MyComponent);
          component = fixture.componentInstance;
          fixture.detectChanges();
      });
  
      it('should be defined', 
          () =&gt; expect(component).toBeDefined();
      );      
  </code></pre>
  
  <p>Please let me know if you have suggestions. I've been trying to find a solution for a long time.
  Thanks in advance..</p>