public void Then_A_PolicyRequestedByNumber() { var requestedPolicyNumber = Guid.NewGuid().ToString(); var policy = PolicyFactory.BuildPolicyWithSpecificPolicyNumber(requestedPolicyNumber); var policies = PolicyFactory.BuildDefaultPolicyCollection(2); policies.Add(policy); _policiesRepositoryMocked .Expects .One .Method(x => x.GetAllPolicies()) .Will(Return.Value(Task.FromResult(policies))); var policyResult = _sut.GetPolicyByNumber(requestedPolicyNumber).Result; Assert.IsNotNull(policyResult); Assert.AreEqual(requestedPolicyNumber, policyResult.Id); }
public async Task <Client> GetClientByPolicyNumber(string policyNumber) { var policy = await _companyPoliciesService.GetPolicyByNumber(policyNumber); return(await _companyClientsService.GetClientById(policy.ClientId)); }