Exemplo n.º 1
0
        public async Task CheckAccountExistsReturnsFalseAnd404()
        {
            var checkAccountExistsResponse = new CheckAccountExistsResponse()
            {
                Exists = false
            };

            var paymentReference = "1234567";
            var postCode         = "E8 1DY";

            _checkRentAccountExistsUseCase.Setup(x => x.Execute(paymentReference, postCode)).ReturnsAsync(checkAccountExistsResponse);
            var response = (await _classUnderTest.CheckRentAccountExists(paymentReference, postCode).ConfigureAwait(true) as IActionResult) as ObjectResult;

            response.Should().NotBeNull();
            response.StatusCode.Should().Be(404);
            response.Value.Should().Be("Account not found");
        }
        public void ReturnsCorrectResponseWhenAccountDoesNotExist()
        {
            var paymentReference           = "1234567";
            var postCode                   = "E8 1DY";
            var token                      = "token";
            var checkAccountExistsResponse =
                new CheckAccountExistsResponse
            {
                Exists = false
            };

            _mockCrmTokenGateway.Setup(x => x.GetCRMToken()).ReturnsAsync("token");
            _mockCrmGateway.Setup(x => x.CheckAccountExists(paymentReference, postCode, token)).ReturnsAsync(checkAccountExistsResponse);

            var response = _classUnderTest.Execute(paymentReference, postCode);

            response.Should().NotBeNull();
            response.Result.Should().BeEquivalentTo(checkAccountExistsResponse);
        }