コード例 #1
0
        public ScriptsContainerConfiguration_Tests()
        {
            container = new TinyIoCContainer();
            container.Register <IJavaScriptMinifier, MicrosoftJavaScriptMinifier>();
            container.Register(typeof(IUrlModifier), Mock.Of <IUrlModifier>());
            container.Register <IUrlGenerator>((c, x) => new UrlGenerator(c.Resolve <IUrlModifier>(), new FakeFileSystem(), "cassette.axd/"));

            configuration = new ScriptContainerConfiguration(type => new Type[0]);
            configuration.Configure(container);

            fileSearch = (FileSearch)container.Resolve <IFileSearch>(HostBase.FileSearchComponentName(typeof(ScriptBundle)));
        }
コード例 #2
0
        public ScriptBundleContainerModuleWithFileSearchModifierTests()
        {
            container = new TinyIoCContainer();
            container.Register <IJavaScriptMinifier, MicrosoftJavaScriptMinifier>();
            container.Register <IUrlGenerator, UrlGenerator>();
            container.Register(typeof(IUrlModifier), Mock.Of <IUrlModifier>());

            var modifier = new Mock <IFileSearchModifier <ScriptBundle> >();

            modifier
            .Setup(m => m.Modify(It.IsAny <FileSearch>()))
            .Callback <FileSearch>(fs => fs.Pattern += ";*.other");

            container.Register(typeof(IFileSearchModifier <ScriptBundle>), modifier.Object);

            configuration = new ScriptContainerConfiguration(type => new Type[0]);
            configuration.Configure(container);

            fileSearch = (FileSearch)container.Resolve <IFileSearch>(HostBase.FileSearchComponentName(typeof(ScriptBundle)));
        }