Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I have a function for converting currency. like

C#
public decimal ExchangeRate()
{
HttpWebRequest request;
HttpWebResponse response;
decimal rate=0;
string completeUrl = string.Format("www.exchangecurrency.com", "INR", "EUR");
request = (HttpWebRequest)WebRequest.Create(completeUrl);
response = (HttpWebResponse)request.GetResponse();
var reader = new StreamReader(response.GetResponseStream());
string json_result = reader.ReadToEnd();
decimal.TryParse(json_result, out rate);
return rate;
}


Now I want writing a test using Rhino mocking.
How I do this Thanks in advance.
Posted
Comments
Tomas Takac 24-Oct-14 7:31am    
What have you tried so far? As I see it your main obstacle is the call to WebRequest.Create() which is static.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900