title: Dynamics 365 money fields base currency recalculation in fakexrmeasy unit tests
body: <p>I'm new to Dynamics 365 and started recently to test my code using fake XRM. </p>
  
  <p>I've just run into a problem related to calculations done on currency (Money) fields, for which additional field is being created (which name ends with '_Base'). In unit tests the base of currency field is not being recalculated.</p>
  
  <p>The scenario is:
  - Code under test sets the "turnover" field of type "Money" on "Account" entity.
  - Later the "turnover" base currency parts are summed up. (Accounts are refreshed in the context before summing up)</p>
  
  <pre><code>localAccount.turnover = new Money(100);
  
  ...
  
  var sumOfTurnovers = localAccounts.Sum(s =&gt; s.turnover_Base?.Value ?? 0); // &lt;-- returns 0 in unit tests
  </code></pre>
  
  <p>Result: the sum of turnovers is calculated as 0, while on real dev environment it is calculated correctly.</p>
  
  <p>It often happens that the code under test relies on recalculated values.</p>
  
  <p>How to emulate re-calculation for such base currency fields in unit tests?</p>