public async Task UpgradePlan_WhenProposedPlanSameAsCurrentPlan_ThrowsException() { var request = new UpgradePlanRequest() { Plan = Account.CurrentPlan.GetPlanType() }; await Assert.ThrowsAsync <InvalidUpgradePlanException>( async() => await Orchestrator.UpgradePlan(Account.Id, request)); }
public async Task UpgradePlan_InvalidPlan_ThrowsException() { var request = new UpgradePlanRequest() { Plan = (Plan)100 }; await Assert.ThrowsAsync <InvalidPlanException>( async() => await Orchestrator.UpgradePlan(Account.Id, request)); }
public async Task UpgradePlan_WhenProposedPlanLesserThanCurrentPlan_ThrowsException() { var request = new UpgradePlanRequest() { Plan = (Plan)1 }; await Assert.ThrowsAsync <InvalidUpgradePlanException>( async() => await Orchestrator.UpgradePlan(Account.Id, request)); }
public async Task UpgradePlan(Guid accountId, UpgradePlanRequest request) { var account = await Repository.GetAccountBy(accountId); if (DoesntExist(account)) { throw new AccountNotFoundException(); } if (!IsPlanValid(request.Plan)) { throw new InvalidPlanException(); } if (IsProposedPlanLessThanCurrentPlan(request.Plan, account)) { throw new InvalidUpgradePlanException(); } await Repository.UpgradePlan(accountId, request.Plan); }
private async Task UpgradePlan(Guid id, UpgradePlanRequest request) { await _client.PutAsync($"{ControllerUrl}/{id}", GetHttpContentFromObj(request)); }
public UpgradePlanRequest GetUpgradePlanRequest(byte[] result) { return(UpgradePlanRequest.ParseFrom(result)); }
public async Task <IActionResult> UpgradePlan(Guid accountId, [FromBody] UpgradePlanRequest request) { await Orchestrator.UpgradePlan(accountId, request); return(Ok()); }