private void When(ClaimRequestCreatedPendingVerificationEvent @event)
 {
     _id = new Guid(@event.ClaimRequestId);
     _claimAmount = @event.Amount.Dollars();
     _claimType = @event.ClaimType;
     CurrentClaimState = ClaimRequestStateEnum.PendingSubstantiation;
 }
 private void When(ClaimRequestAutoSubstantiatedEvent @event)
 {
     _id = new Guid(@event.ClaimRequestId);
     _claimAmount = @event.Amount.Dollars();
     _claimType = @event.ClaimType;
     CurrentClaimState = ClaimRequestStateEnum.Substantiated;
 }
 private void When(ElectionMadeEvent @event)
 {
     //The command has been validated and we are now going to apply
     //the state change to this instance.
     //This state transition CAN NOT FAIL now.
     //Note: this method may be called in either of these cases:
     //  1 - the command is being processed for the first time
     //  2 - the event has been replayed from the event store
     _id = new Guid(@event.Id);
     _electionAmount = @event.ElectionAmount.Dollars();
 }
        private static bool ElectionAmountBreachsLimitForPlanYear(Money electionAmount, IBenefitsReadModel benefitsService, string planYearBenefitId)
        {
            var planYearBenefit = benefitsService.GetPlanYearBenefit(planYearBenefitId);

            if (planYearBenefit.HasAnnualLimit &&
                electionAmount > planYearBenefit.AnnualLimit.Dollars())
            {
                return true;
            }

            return false;
        }
 private void When(ElectionAmountChangedEvent @event)
 {
     _electionAmount = @event.NewElectionAmount.Dollars();
     _qualifyingEvent = @event.QualifyingEvent;
 }
 public void When(NewBenefitDefinedEvent @event)
 {
     _id = Guid.Parse(@event.BenefitId);
     _hasMaxAnnualAmount = @event.HasMaxElectionAmount;
     _maxAnnualAmount = @event.MaxElectionAmount.Dollars();
 }