How to Mock HttpWebRequest and HttpWebResponse using the Moq Framework?
- by Nicholas
How do you use the Moq Framework to Mock HttpWebRequest and HttpWebResponse in the following Unit Test?
[Test]
public void Verify_That_SiteMap_Urls_Are_Reachable()
{
// Arrange - simplified
Uri uri = new Uri("http://www.google.com");
// Act
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse…