title: Unit Testing Model property binding in Angular 5
body: <p>I am using Angular 5 with Jasmine to perform Unit Testing.</p>
  
  <p>I have a model called PlayerAccount array that looks like the following:</p>
  
  <pre><code>export interface IPlayerAccount {
    playerId: number;
    name: string;
    phone: number;
    street: string;
    postcode: string;
    state: string;
    country: string;
  }
  </code></pre>
  
  <p>This PlayerAccount array gets populated on ngOnInit by calling method</p>
  
  <pre><code>getPlayerAccounts(playerId: number);
  </code></pre>
  
  <p>I'm trying to unit test that the returned PlayerAccount data successfully binds to the PlayerAccount array.</p>
  
  <p>I have got this far but I feel like my approach is a little hacky, so I’m wondering if there is a nicer way to bind the returned data from getPlayerAccounts to my array of IPlayerAccount </p>
  
  <pre><code> it('check that array of players successfully bind to component accounts players array', async () =&gt; {
            fixture.detectChanges();
  
            IPlayerAccount accounts = new IPlayerAccount();
  
            var account1 = new IPlayerAccount();
            account1.playerId = 1;
            account1.name = 'Ben';
            account1.phone = 12345;
            account1.street = 'Cloud Street';
            account1.postcode = 111;
            account1.state = 'MELB'
            account1.country = 'AU';
  
            var account2 = new IPlayerAccount();
            account2.playerId = 2;
            account2.name = 'James';
            account2.phone = 6789;
            account2.street = 'Jamming Street';
            account2.postcode = 2323;
            account2.state = 'VIC'
            account2.country = 'AU';
  
            component.accounts.push(account1);
            component.accounts.push(account2);
  
            IPlayerAccount[] returnedAccounts = component.getMerchantAccounts(1);
  
            expect(component.accounts[0]).toEqual(returnedAccounts[0]);
            expect(component.accounts[1]).toEqual(returnedAccounts[1]);
  
          });
  </code></pre>
  
  <p>Can someone please help me write this unit test? Any help would be greatly appreciated!</p>
  
  <p>Thanks</p>