Example #1
0
        public void Then_A_ClientRequestedById()
        {
            var requestedClientId = Guid.NewGuid().ToString();
            var client            = ClientFactory.BuildClientRepositoryModelWithSpecificId(requestedClientId);

            _clientsRepositoryMocked
            .Expects
            .One
            .Method(x => x.GetClientById(requestedClientId))
            .With(requestedClientId)
            .Will(Return.Value(Task.FromResult(client)));

            var clientResult = _sut.GetClientById(requestedClientId).Result;

            Assert.IsNotNull(clientResult);
            Assert.AreEqual(requestedClientId, clientResult.Id);
        }
Example #2
0
        public async Task <IHttpActionResult> GetClientById(string id)
        {
            try
            {
                var userInfo = await _companyClientsService.GetClientById(id);

                if (userInfo == null)
                {
                    return(NotFound());
                }

                return(Ok(userInfo));
            }
            catch (Exception exception)
            {
                return(ManageExceptionAndBuildResult(nameof(id), id, exception));
            }
        }
        public async Task <Client> GetClientByPolicyNumber(string policyNumber)
        {
            var policy = await _companyPoliciesService.GetPolicyByNumber(policyNumber);

            return(await _companyClientsService.GetClientById(policy.ClientId));
        }