Skip to content

Instantly share code, notes, and snippets.

@danstuken
Created June 30, 2011 13:27
Show Gist options
  • Save danstuken/1056233 to your computer and use it in GitHub Desktop.
Save danstuken/1056233 to your computer and use it in GitHub Desktop.
[TestCase("/categoryName/itemname", "/sitebaseaddress/hub/categoryName.aspx")]
public void GetDestinationUrl_ValidUrls_ReturnsCorrectDestionation(string url, string expected)
{
var cacheHandler = new Mock<IMappingCacheHandler>();
var httpContext = new Mock<IHttpContextFacade>();
var target = new DataMap(null, cacheHandler.Object, httpContext.Object);
var mappings = new List<Data>();
string baseUrl = "/sitebaseaddress/";
cacheHandler.Setup(ch => ch.Load<Data>()).Returns(mappings);
cacheHandler.Setup(ch => ch.Save(It.IsAny<List<Data>>()));
httpContext.Setup(hc => hc.GetAppPath()).Returns(baseUrl);
target.HttpContext = httpContext.Object;
var destUrl = target.GetDestinationUrl(url);
Assert.AreEqual(expected, destUrl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment