public void Process_Url(String? url, String newUrl) { TagHelperContent content = new DefaultTagHelperContent(); IUrlHelperFactory factory = MvcHelperFactory.CreateUrlHelperFactory(null); MvcLookupTagHelper helper = new(Substitute.For<IHtmlGenerator>(), factory); TagHelperContext context = new(new TagHelperAttributeList(), new Dictionary<Object, Object>(), "test"); TagHelperOutput output = new("div", new TagHelperAttributeList(), (_, _) => Task.FromResult(content)); helper.Url = url; helper.Handler = "Handling"; helper.Process(context, output); String? expected = newUrl; String? actual = helper.Url; Assert.Equal(expected, actual); }
public AppStyleTagHelperTests() { host = Substitute.For <IWebHostEnvironment>(); TagHelperContent content = new DefaultTagHelperContent(); ViewContext viewContext = MvcHelperFactory.CreateViewContext(); IUrlHelperFactory factory = MvcHelperFactory.CreateUrlHelperFactory(viewContext); context = new TagHelperContext(new TagHelperAttributeList(), new Dictionary <Object, Object>(), "test"); output = new TagHelperOutput("link", new TagHelperAttributeList(), (_, _) => Task.FromResult(content)); host.WebRootPath.Returns(Directory.GetCurrentDirectory()); helper = new AppStyleTagHelper(host, factory); helper.ViewContext = viewContext; helper.Action = "Test"; if (Directory.Exists("css")) { Directory.Delete("css", true); } }