Exemple #1
0
        public static Mock <HttpMessageHandler> AddNonce(this Mock <HttpMessageHandler> messageHandler)
        {
            var responseMessage = new HttpResponseMessage
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = null
            };

            responseMessage.Headers.Add("Replay-Nonce", Guid.NewGuid().ToString());
            return(messageHandler.AddResponse(AcmeDirectory.NewNonce, responseMessage));
        }
Exemple #2
0
        public static Mock <HttpMessageHandler> AddDirectoryResponse(this Mock <HttpMessageHandler> messageHandler)
        {
            var serializedDictionary = JsonSerializer.Serialize(AcmeDirectory);
            var responseMessage      = new HttpResponseMessage
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = new StringContent(serializedDictionary, Encoding.UTF8, "application/json"),
            };

            return(messageHandler.AddResponse(DirectoryUri, responseMessage));
        }