void ResponseFilter_can_patch_html_urls(string suffix, string pre, string expectedPatched, Uri requestUrl = null) { i18n.EarlyUrlLocalizer obj = new i18n.EarlyUrlLocalizer(new UrlLocalizer()); string post = obj.ProcessOutgoing(pre, suffix, null); Assert.AreEqual(expectedPatched, post); }
void Helper_ResponseFilter_can_patch_html_urls(string suffix, string pre, string expectedPatched, string requestUrl = "http://example.com/blog") { HttpRequestBase fakeRequest = Substitute.For <HttpRequestBase>(); HttpResponseBase fakeResponse = Substitute.For <HttpResponseBase>(); HttpContextBase fakeContext = Substitute.For <HttpContextBase>(); fakeRequest.Url.Returns(requestUrl.IsSet() ? new Uri(requestUrl) : null); fakeResponse.Headers.Returns(new System.Net.WebHeaderCollection { //{ "Authorization", "xyz" } }); fakeContext.Request.Returns(fakeRequest); fakeContext.Response.Returns(fakeResponse); i18n.EarlyUrlLocalizer obj = new i18n.EarlyUrlLocalizer(new UrlLocalizer()); string post = obj.ProcessOutgoingNuggets(pre, suffix, fakeContext); Assert.AreEqual(expectedPatched, post); }