Skip to content

Instantly share code, notes, and snippets.

@stack72
Created June 30, 2011 14:36
Show Gist options
  • Save stack72/1056347 to your computer and use it in GitHub Desktop.
Save stack72/1056347 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 mappingLoader = Substitute.For<IMappingLoader>();
var cacheHandler = Substitute.For<IMappingCacheHandler>();
var httpContext = Substitute.For<IHttpContextFacade>();
var mapping = new List<Data>();
httpContext.GetAppPath().Returns("/sitebaseaddress/");
cacheHandler.Load<Data>().Returns(mapping);
DataMap target = new DataMap(mappingLoader, cacheHandler, httpContext);
target.HttpContext = httpContext;
var actual = target.GetDestinationUrl(url);
Assert.That(actual, Is.EqualTo(expected));
cacheHandler.Received().Save(mapping);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment