Exemple #1
0
        public async Task DeleteLinkedAccountAnd204()
        {
            var deleteAccountResponse = new DeleteLinkedAccountResponse
            {
                success = true
            };
            var cssoId = "456";

            _deleteLinkedAccountUseCase.Setup(x => x.Execute(cssoId)).ReturnsAsync(deleteAccountResponse);
            var response = (await _classUnderTest.UnlinkAccount(cssoId).ConfigureAwait(true) as IActionResult) as NoContentResult;

            response.Should().NotBeNull();
            response.StatusCode.Should().Be(204);
        }
Exemple #2
0
        public async Task DeleteLinkedAccountWithInvalidRefReturns404()
        {
            var deleteAccountResponse = new DeleteLinkedAccountResponse();

            deleteAccountResponse = null;
            var cssoId = "456";

            _deleteLinkedAccountUseCase.Setup(x => x.Execute(cssoId)).ReturnsAsync(deleteAccountResponse);
            var response = (await _classUnderTest.UnlinkAccount(cssoId).ConfigureAwait(true) as IActionResult) as ObjectResult;

            response.Should().NotBeNull();
            response.StatusCode.Should().Be(404);
            response.Value.Should().Be("Linked account not found");
        }
        public async Task <DeleteLinkedAccountResponse> Execute(string cssoId)
        {
            var token = await _crmTokenGateway.GetCRMToken();

            var crmResponse = await _crmGateway.GetLinkedAccount(cssoId, token);

            if (crmResponse == null || crmResponse.value.Count == 0)
            {
                return(null);
            }
            var linkId            = crmResponse.value[0].hackney_csso_linked_rent_accountid;
            var crmDeleteResponse = await _crmGateway.DeleteLinkedAccount(linkId);

            var deleteLinkedAccountResponse = new DeleteLinkedAccountResponse
            {
                success = crmDeleteResponse
            };

            return(deleteLinkedAccountResponse);
        }