public static UrlHelper SetupUrlHelper(string baseUrl) { var routes = new RouteCollection(); var request = new Mock <HttpRequestBase>(); request.SetupGet(x => x.ApplicationPath).Returns("/"); request.SetupGet(x => x.Url).Returns(new Uri(baseUrl, UriKind.Absolute)); request.SetupGet(x => x.ServerVariables).Returns(new System.Collections.Specialized.NameValueCollection()); var response = new Mock <HttpResponseBase>(); response.Setup(x => x.ApplyAppPathModifier(It.IsAny <string>())).Returns((string url) => url); response.Setup(x => x.AddCacheDependency(It.IsAny <CacheDependency>())); var context = new Mock <HttpContextBase>(); context.SetupGet(x => x.Request).Returns(request.Object); context.SetupGet(x => x.Response).Returns(response.Object); var application = new MockHttpApplicationState(); context.SetupGet(x => x.Application).Returns(application); return(new UrlHelper(new RequestContext(context.Object, new RouteData()), routes)); }
public void ConfigureWebpack_Populates_Application() { var webpack = new Mock <IWebpack>().Object; var application = new MockHttpApplicationState(); var server = new Mock <HttpServerUtilityBase>(); application.ConfigureWebpack(webpack); Assert.That(application.GetWebpack(), Is.SameAs(webpack)); }