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)); }
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)); }