public void TestFactoryInstance() { InjectorFactory factory = new InjectorFactory(); IInjector testInjector = factory.Create(typeof(IScriptFilesInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IScriptFilesInjector)); Assert.IsInstanceOfType(testInjector, typeof(ScriptFilesInjector)); testInjector = factory.Create(typeof(IStyleFilesInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IStyleFilesInjector)); Assert.IsInstanceOfType(testInjector, typeof(StyleFilesInjector)); testInjector = factory.Create(typeof(IMetaTagsInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IMetaTagsInjector)); Assert.IsInstanceOfType(testInjector, typeof(MetaTagsInjector)); testInjector = factory.Create(typeof(IScriptBlocksInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IScriptBlocksInjector)); Assert.IsInstanceOfType(testInjector, typeof(ScriptBlocksInjector)); testInjector = factory.Create(typeof(IPlaceholderInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IPlaceholderInjector)); Assert.IsInstanceOfType(testInjector, typeof(PlaceholderInjector)); testInjector = factory.Create(typeof(IHiddenFieldsInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IHiddenFieldsInjector)); Assert.IsInstanceOfType(testInjector, typeof(HiddenFieldsInjector)); }
public void Construction() { StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); HttpContextBase httpContext = new MockHttpContext(); InjectorFactory services = new InjectorFactory(); Assert.IsNotNull(services); ContentManager manager = new ContentManager(writer, httpContext, services); Assert.IsNotNull(manager); manager.Dispose(); manager = null; manager = new ContentManager(writer, httpContext, services); TextWriter contentWriter = manager.ContentWriter; Assert.IsNotNull(contentWriter); Assert.IsInstanceOfType(contentWriter, typeof(StringWriter)); }
public void TestReplace() { InjectorFactory factory = new InjectorFactory(); IInjector testInjector = factory.Create(typeof(IScriptFilesInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IScriptFilesInjector)); Assert.IsInstanceOfType(testInjector, typeof(ScriptFilesInjector)); factory.Register(typeof(IScriptFilesInjector), typeof(CustomScriptFileInjector)); testInjector = factory.Create(typeof(IScriptFilesInjector)); Assert.IsNotNull(testInjector); Assert.IsInstanceOfType(testInjector, typeof(IScriptFilesInjector)); Assert.IsInstanceOfType(testInjector, typeof(CustomScriptFileInjector)); }
ContentManager CreateContentManager(StringBuilder sb) { StringWriter writer = new StringWriter(sb); HttpContextBase httpContext = new MockHttpContext(); InjectorFactory services = new InjectorFactory(); Assert.IsNotNull(services); ContentManager manager = new ContentManager(writer, httpContext, services); Assert.IsNotNull(manager); return manager; }