コード例 #1
0
        public async Task GetPaymentsAsync_ValidRequest_ReturnIEnumerableOfPaymentResourceResponse()
        {
            SetValidUserInControllerContext();
            _service
            .Setup(s => s.GetAllUserPaymentsAsync(_validUserId))
            .ReturnsAsync(It.IsAny <IEnumerable <Payment> >());

            var currencyResources = new List <PaymentResource>()
                                    .AsEnumerable();

            _mapper
            .Setup(m => m.Map <IEnumerable <Payment>, IEnumerable <PaymentResource> >(It.IsAny <IEnumerable <Payment> >()))
            .Returns(currencyResources);

            var response = await _controller.GetPaymentsAsync();

            var result = response.Result as ObjectResult;

            Assert.Equal((int)HttpStatusCode.OK, result.StatusCode);
            Assert.True(result.Value is IEnumerable <PaymentResource>);

            ResetMocks();
        }