Ejemplo n.º 1
0
        public static HttpResponseMessage AddTokenErrorResponse(
            this MockHttpManager httpManager,
            string error,
            HttpStatusCode?customStatusCode)
        {
            var responseMessage = MockHelpers.CreateFailureTokenResponseMessage(error, customStatusCode: customStatusCode);
            var handler         = new MockHttpMessageHandler()
            {
                ExpectedMethod  = HttpMethod.Post,
                ResponseMessage = responseMessage
            };

            httpManager.AddMockHandler(handler);
            return(responseMessage);
        }
Ejemplo n.º 2
0
        public static MockHttpMessageHandler AddFailureTokenEndpointResponse(
            this MockHttpManager httpManager,
            string error,
            string authority     = TestConstants.AuthorityCommonTenant,
            string correlationId = null)
        {
            var handler = new MockHttpMessageHandler()
            {
                ExpectedUrl     = authority + "oauth2/v2.0/token",
                ExpectedMethod  = HttpMethod.Post,
                ResponseMessage = MockHelpers.CreateFailureTokenResponseMessage(
                    error,
                    correlationId: correlationId)
            };

            httpManager.AddMockHandler(handler);
            return(handler);
        }