Пример #1
0
        public void WhenITryToSendRequestToEndPointAndGetResponse()
        {
            var ipAddress = Get <string>(SecurityContextFields.IpAddress);
            var brandName = Get <string>(SecurityContextFields.BrandName);

            var request = new VerifyIpRequest
            {
                IpAddress = ipAddress,
                BrandName = brandName
            };

            try
            {
                var result = MemberApiProxy.VerifyIp(request);

                result.Should().NotBeNull();

                Set(SecurityContextFields.ErrorCode, HttpStatusCode.OK);
                Set(SecurityContextFields.Result, result);
            }
            catch (MemberApiValidationException e)
            {
                Set(SecurityContextFields.ErrorCode, e.StatusCode);

                var regoValidationError = e.ValidationErrors.FirstOrDefault();
                if (regoValidationError != null)
                {
                    Set(SecurityContextFields.ErrorMessage, regoValidationError.ErrorMessage);
                }
            }
        }