public void ImageTagHelper_DoesNotUseMemoryCacheInstanceFromDI() { // Arrange var activator = new DefaultTagHelperActivator(new TypeActivatorCache()); var viewContext = CreateViewContext(); var imageTagHelper = activator.Create <ImageTagHelper>(viewContext); Assert.Same(CacheProvider.Cache, imageTagHelper.Cache); Assert.Same(HostingEnvironment, imageTagHelper.HostingEnvironment); }
public void LinkTagHelper_DoesNotUseMemoryCacheInstanceFromDI() { // Arrange var activator = new DefaultTagHelperActivator(); var viewContext = CreateViewContext(); var linkTagHelper = activator.Create <LinkTagHelper>(viewContext); Assert.Same(CacheProvider.Cache, linkTagHelper.Cache); Assert.Same(HostingEnvironment, linkTagHelper.HostingEnvironment); Assert.Same(FileVersionProvider, linkTagHelper.FileVersionProvider); }
public void CreateTagHelper_InitializesTagHelpers() { // Arrange var httpContext = new DefaultHttpContext() { RequestServices = new ServiceCollection().BuildServiceProvider() }; var viewContext = MakeViewContext(httpContext); var viewDataValue = new object(); viewContext.ViewData.Add("TestData", viewDataValue); var activator = new DefaultTagHelperActivator(new TypeActivatorCache()); // Act var helper = activator.Create<TestTagHelper>(viewContext); // Assert Assert.NotNull(helper); }